Hi,
Given a sentence, I'm trying to check if all the individual constituents of a word are present in it and if they are then do some further processing. I can't seem to get the logic to work.
wordlist = ['England area','Germanic 6th']
mysentence = 'The area now called England has been settled by people of various cultures for about 35,000 years, but it takes its name from the Angles, one of the Germanic tribes who settled during the 5th and 6th centuries.'
for words in wordlist:
#split each individual word into constituent items
word_items = words.split(' ')
#the word "England area" is now two words "England" and "area" and I want to
#check if both of these words are present (anywhere) in the sentence, if BOTH are
#present then print the sentence, else check the next word in wordlist.
for w in witems:
if mysentence.find(w) >= 0:
.....
I can check if the first constituent of the word is present "England) and if the second "area" is present but only individually, how to check if both are present?
Thanks,
Adi