I am trying to run this code, for natural language processing.
import nltk
from nltk import load_parser
cp = load_parser('grammars/book_grammars/sql0.fcfg')
query = 'What cities are located in China'
trees = cp.nbest_parse(query.split())
answer = trees[0].node['sem']
q = ' '.join(answer)
print(q)
But i am getting the following compilation error:
trees = cp.nbest_parse(query.split())
AttributeError: 'FeatureChartParser' object has no attribute 'nbest_parse'
I am using python3.4 and nltk 3.0a4 . What can I do now to run this?