[Solved] how to find the words that are likely to follow the single word in large string in python .?


You can use a regex to look for words that follow the word python, for example

>>> import re
>>> re.findall(r'Python (\w+)', s)
['is', 'has', 'features', 'interpreters', 'code', 'is', 'Software']

Since this list may contain duplicates, you could create a set if you want a collection of unique words

>>> set(re.findall(r'Python (\w+)', s))
{'Software', 'is', 'has', 'interpreters', 'code', 'features'}

0

solved how to find the words that are likely to follow the single word in large string in python .?