1

I am trying to get a list of all the trigrams in a sentence which does not have the starting of that sentence.

i wrote the following code :-

import re
s= "He was working on the table"
middle_trigram_list = re.findall("\s+[a-z]+\s[a-z]+\s[a-z]+\s+",s)
print (middle_trigram_list)
[' was working on ']

and i got the output only as [' was working on '] , i wonder why "working on the " was not included in the list.

Thanks!!

0 Answers0