PP -> P NP NP -> Det N | Det N PP | 'I' VP -> V NP | VP PP Det -> 'an' | 'my' N -> 'elephant' | 'pajamas' V -> 'shot' P -> 'in' """) # In[19]: # ref: http://www.nltk.org/book_1ed/ch08.html sent = ['I', 'shot', 'an', 'elephant', 'in', 'my', 'pajamas'] parser = nltk.ChartParser(groucho_grammar) trees = parser.parse(sent) for tree in trees: print(tree) # In[5]: ## part C begins here # In[20]: #conda install -c conda-forge spacy=2.2.1 # conda install -c conda-forge spacy-model-en_core_web_sm #https://www.analyticsvidhya.com/blog/2019/10/how-to-build-knowledge-graph-text-using-spacy/ import spacy print(spacy.__version__)