I've got a list of verbs:
verbs = ['eat', 'fly', 'look', 'throw', 'take']
And a text:
text = "eatcatthrowballthenlookforthesnake"
I've used this to replace all of the verbs in the text with "VERB":
for x in verbs:
if re.search(x, text):
text = text.replace(x, str('VERB'))
So if I do:
So far so good.
I need to add another part, but I don't know any way to impliment it. As you saw above, three verbs appeared in the text, I'd like to set them each as variables, in the same order that they appeared in the text:
Thus, (in maybe an absurd example) if the text has 10,000 verbs, the last one will be called verb10000='fly'.
Just as another example, a text such as this:
text = "eatfoodeatcandydonoteatsnakesthrowthecloud"
**(or a similar way to create and manage lots of variables)