spaCy/spacy/tests/parser/test_initial_actions_parse.py

17 lines
430 B
Python
Raw Normal View History

import pytest
2015-08-26 17:22:06 +00:00
@pytest.mark.models
def test_initial(EN):
doc = EN.tokenizer(u'I ate the pizza with anchovies.')
EN.tagger(doc)
2015-09-06 03:40:10 +00:00
with EN.parser.step_through(doc) as stepwise:
stepwise.transition('L-nsubj')
stepwise.transition('S')
stepwise.transition('L-det')
assert doc[0].head.i == 1
2015-08-08 21:38:19 +00:00
assert doc[1].head.i == 1
2015-08-08 21:45:36 +00:00
assert doc[2].head.i == 3
assert doc[3].head.i == 3
2015-08-08 21:38:19 +00:00
assert doc