I have a list of words that I want to search in a string of large text.I have defined a function that returns each individual word but I dont know how to pass the function to re.findall(). I want to get any sentense that contains any word that is in words list. Can someone assist :) here is what I got:
strings = ['some large text', 'some large text'...]
ad = []
words = ['ascertained','deep','detected','disclosed','disinterred','espied','explored','exposed','famous','happened upon','identified','invented','learned','observed','perceived','presented','revealed','searched out','shown','sighted','spotted','unveiled']
def word():
for i in words:
t = word[i]
return t
for i in range(len(strings)):
ad += re.findall(r"([^.]*?word()[^.]*\.)",strings[i])
sep = ''
adc = sep.join(ad)