Is there a way (Pattern or Python or NLTK, etc) to detect of a sentence has a list of words in it.
i.e.
The cat ran into the hat, box, and house. | The list would be hat, box, and house
This could be string processed but we may have more generic lists:
i.e.
The cat likes to run outside, run inside, or jump up the stairs. |
List=run outside, run inside, or jump up the stairs.
This could be in the middle of a paragraph or the end of the sentence which further complicates things.
I’ve been working with Pattern for python for awhile and I’m not seeing a way to go about this and was curious if there is a way with pattern or nltk (natural language tool kit).
What about using
from nltk.tokenize import sent_tokenize?Then you can use that list of sentences in this way:
More info here