def projective_rule_parse_demo():
 grammar = DependencyGrammar.fromstring(u"\n    'scratch' -> 'cats' | 'walls'\n    'walls' -> 'the'\n    'cats' -> 'the'\n    ")
 print(grammar)
 pdp = ProjectiveDependencyParser(grammar)
 trees = pdp.parse([u'the', u'cats', u'scratch', u'the', u'walls'])
 for tree in trees:
  print(tree)

def projective_rule_parse_demo ( ) : grammar = DependencyGrammar . fromstring ( u"\n    'scratch' -> 'cats' | 'walls'\n    'walls' -> 'the'\n    'cats' -> 'the'\n    " ) print ( grammar ) pdp = ProjectiveDependencyParser ( grammar ) trees = pdp . parse ( [ u'the' , u'cats' , u'scratch' , u'the' , u'walls' ] ) for tree in trees : print ( tree )
a demonstration showing the creation and use of a dependencygrammar to perform a projective dependency parse .