R
R
Rokaka2021-06-10 19:07:08
Python
Rokaka, 2021-06-10 19:07:08

How to make the program look for keywords in sentences?

Only 2 keywords and many sentences, some of which contain keywords.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-06-10
@Rokaka

Regular expressions (modulo re), in particular the marker \b - word boundary.
The "gate" regular will find both "gate" and "turn" and "collar" The
"\bgate\b" regular will find only "gate" but not "turn" / "collar".
But if you need word forms ("flying / flying / flying / flying"), then the task becomes more complicated.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question