0

I am parsing English sentences using NLTK library. Every time i parse a sentence i provide grammar specific to that sentence e.g. if need to parse

I shot an elephant in my pajamas

I will provide grammar something like this

 grammar = nltk.parse_cfg("""
 S -> NP VP
 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'
 """)

Above grammar includes non terminals which are specific to this sentence only. Is there any grammar which can works for every sentence? Stanford Parser do this thing. Can we get the grammar used by Stanford Parser for this purpose
Also what will you recommend nltk or Stanford Parser.
Thanks

Sakthi Kumar
  • 3,047
  • 15
  • 28
Haider Ali
  • 800
  • 2
  • 9
  • 22

0 Answers0