Open loretoparisi opened 7 years ago
Like getting the PCFG
grammar
grammar=parser.pcfg
The problem is that I get this error
AttributeError: PCFG instance has no attribute 'productions'
when passing this grammar to the RecursiveDescentApp NLTK example: http://www.nltk.org/_modules/nltk/app/rdparser_app.html
like
parser = Parser()
text="How can the net amount of entropy of the universe be massively decreased?"
sent=text.split()
tree = parser.parse(text)
print tree
grammar = parser.pcfg
RecursiveDescentApp(grammar, sent).mainloop()
that fails with
Traceback (most recent call last):
File "wordstree.py", line 906, in <module>
app()
File "wordstree.py", line 903, in app
RecursiveDescentApp(grammar, sent).mainloop()
File "wordstree.py", line 120, in __init__
self._init_grammar(self._top)
File "wordstree.py", line 166, in _init_grammar
self._productions = list(self._parser.grammar().productions())
Supposed to have
will
pyStatParser
output a CFG string for the grammar?