I have two lists: The first one includes sentences and the second one includes parts of speech (POS) tags. I want to use POS tags as a filter and find phrases according to a pattern such as 'JJ JJ NNS' (adjective+adjective+noun)
How can I do that?
import re key_list= [' techniques from nonlinear analysis and partial differential equations form the basis for these studies .', ' in this case , center-manifold theory can be applied to study the ordinary differential equations which replace the nonlinear \ partial differential equations for the wave motion .', ' differential equations are cool .'] value_list = ['NNS IN JJ NN CC JJ JJ NNS VBP DT NN IN DT NNS .', ' IN DT NN , JJ NN MD VB VBN TO VB DT JJ NN NNS WDT VB DT JJ JJ JJ NNS IN DT NN NN .', ' JJ NNS VBP JJ .'] pattern= re.compile('JJ JJ NNS',re.M|re.DOTALL) for value in value_list: value_output = pattern.findall(value) print(value_output) # I want partial differential equations and ordinary differential equations