Jul-05-2019, 02:22 PM
(This post was last modified: Jul-05-2019, 02:22 PM by constantin01.)
Hi
I am reading "Natural Language Processing with Python" and the author gives example of use of CFG in nltk
But what if I want to parse arbitary sentence? How I can automize the process of description of given sentence? I was thinking that I can use tagged sentence, but nltk functions for parsing take only list of words (not list of tuples with word and tag).
I am reading "Natural Language Processing with Python" and the author gives example of use of CFG in nltk
grammar2 = nltk.parse_cfg(""" S -> NP VP NP -> Det Nom | PropN Nom -> Adj Nom | N VP -> V Adj | V NP | V S | V NP PP PP -> P NP PropN -> 'Buster' | 'Chatterer' | 'Joe' Det -> 'the' | 'a' N -> 'bear' | 'squirrel' | 'tree' | 'fish' | 'log' Adj -> 'angry' | 'frightened' | 'little' | 'tall' V -> 'chased' | 'saw' | 'said' | 'thought' | 'was' | 'put' P -> 'on' """)
But what if I want to parse arbitary sentence? How I can automize the process of description of given sentence? I was thinking that I can use tagged sentence, but nltk functions for parsing take only list of words (not list of tuples with word and tag).