Skip to content

Instantly share code, notes, and snippets.

@bogsio
Created August 13, 2014 22:55
Show Gist options
  • Save bogsio/dcae9bf341045ee206b1 to your computer and use it in GitHub Desktop.
Save bogsio/dcae9bf341045ee206b1 to your computer and use it in GitHub Desktop.
parse demo
viterbi_parser = PCFGViterbiParser.train(open('corpus.txt', 'r'), root='ROOT')
t = viterbi_parser.parse(
nltk.word_tokenize('Numerous passing references to the phrase have occurred in movies'))
print t
t.draw()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment