|
>>> dp = NonprojectiveDependencyParser(grammar)
>>> for g in dp.parse(['the', 'man', 'taught', 'his', 'dog', 'to', 'play', 'golf']):
... print(g)
[{'address': 0, 'deps': 3, 'rel': 'TOP', 'tag': 'TOP', 'word': None},
{'address': 1, 'deps': [], 'word': 'the'},
{'address': 2, 'deps': [1], 'word': 'man'},
{'address': 3, 'deps': [2, 7], 'word': 'taught'},
{'address': 4, 'deps': [], 'word': 'his'},
{'address': 5, 'deps': [4], 'word': 'dog'},
{'address': 6, 'deps': [], 'word': 'to'},
{'address': 7, 'deps': [5, 6, 8], 'word': 'play'},
{'address': 8, 'deps': [], 'word': 'golf'}]
|