You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.6 KiB
Plaintext
24 lines
1.6 KiB
Plaintext
>>> chart = Chart(E0)
|
|
|
|
>>> chart.parses('the wumpus that is smelly is near 2 2')
|
|
[[0, 9, 'S', [[0, 5, 'NP', [[0, 2, 'NP', [('Article', 'the'), ('Noun', 'wumpus')], []], [2, 5, 'RelClause', [('That', 'that'), [3, 5, 'VP', [[3, 4, 'VP', [('Verb', 'is')], []], ('Adjective', 'smelly')], []]], []]], []], [5, 9, 'VP', [[5, 6, 'VP', [('Verb', 'is')], []], [6, 9, 'PP', [('Preposition', 'near'), [7, 9, 'NP', [('Digit', '2'), ('Digit', '2')], []]], []]], []]], []]]
|
|
|
|
### There is a built-in trace facility (compare [Fig. 22.9])
|
|
>>> Chart(E_, trace=True).parses('I feel it')
|
|
parse: added [0, 0, 'S_', [], ['S']]
|
|
predictor: added [0, 0, 'S', [], ['NP', 'VP']]
|
|
predictor: added [0, 0, 'NP', [], ['Art', 'N']]
|
|
predictor: added [0, 0, 'NP', [], ['Pronoun']]
|
|
scanner: added [0, 1, 'NP', [('Pronoun', 'I')], []]
|
|
extender: added [0, 1, 'S', [[0, 1, 'NP', [('Pronoun', 'I')], []]], ['VP']]
|
|
predictor: added [1, 1, 'VP', [], ['V', 'NP']]
|
|
scanner: added [1, 2, 'VP', [('V', 'feel')], ['NP']]
|
|
predictor: added [2, 2, 'NP', [], ['Art', 'N']]
|
|
predictor: added [2, 2, 'NP', [], ['Pronoun']]
|
|
scanner: added [2, 3, 'NP', [('Pronoun', 'it')], []]
|
|
extender: added [1, 3, 'VP', [('V', 'feel'), [2, 3, 'NP', [('Pronoun', 'it')], []]], []]
|
|
extender: added [0, 3, 'S', [[0, 1, 'NP', [('Pronoun', 'I')], []], [1, 3, 'VP', [('V', 'feel'), [2, 3, 'NP', [('Pronoun', 'it')], []]], []]], []]
|
|
extender: added [0, 3, 'S_', [[0, 3, 'S', [[0, 1, 'NP', [('Pronoun', 'I')], []], [1, 3, 'VP', [('V', 'feel'), [2, 3, 'NP', [('Pronoun', 'it')], []]], []]], []]], []]
|
|
[[0, 3, 'S', [[0, 1, 'NP', [('Pronoun', 'I')], []], [1, 3, 'VP', [('V', 'feel'), [2, 3, 'NP', [('Pronoun', 'it')], []]], []]], []]]
|
|
|