def projective_prob_parse_demo():
 from nltk.parse.dependencygraph import conll_data2
 graphs = [DependencyGraph(entry) for entry in conll_data2.split(u'\n\n') if entry]
 ppdp = ProbabilisticProjectiveDependencyParser()
 print(u'Training Probabilistic Projective Dependency Parser...')
 ppdp.train(graphs)
 sent = [u'Cathy', u'zag', u'hen', u'wild', u'zwaaien', u'.']
 print(u"Parsing '", u' '.join(sent), u"'...")
 print(u'Parse:')
 for tree in ppdp.parse(sent):
  print(tree)

def projective_prob_parse_demo ( ) : from nltk . parse . dependencygraph import conll_data2 graphs = [ DependencyGraph ( entry ) for entry in conll_data2 . split ( u'\n\n' ) if entry ] ppdp = ProbabilisticProjectiveDependencyParser ( ) print ( u'Training Probabilistic Projective Dependency Parser...' ) ppdp . train ( graphs ) sent = [ u'Cathy' , u'zag' , u'hen' , u'wild' , u'zwaaien' , u'.' ] print ( u"Parsing '" , u' ' . join ( sent ) , u"'..." ) print ( u'Parse:' ) for tree in ppdp . parse ( sent ) : print ( tree )
a demo showing the training and use of a projective dependency parser .