From fb92e2d06184ffe52c2b7fb3122f31f6acc1a448 Mon Sep 17 00:00:00 2001 From: kengz Date: Sun, 16 Oct 2016 15:12:08 -0400 Subject: [PATCH] activate parse_tree test, use from_array, test for root correctness --- spacy/tests/tokens/test_tokens_api.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spacy/tests/tokens/test_tokens_api.py b/spacy/tests/tokens/test_tokens_api.py index 00ace4c42..1b46ecb67 100644 --- a/spacy/tests/tokens/test_tokens_api.py +++ b/spacy/tests/tokens/test_tokens_api.py @@ -208,9 +208,14 @@ def test_has_vector(EN): assert doc.has_vector -@pytest.mark.models def test_parse_tree(EN): - trees = EN.parse_tree(u'''Bob brought Alice the pizza.''') + text = 'I like New York in Autumn.' + EN = English(parser=False) + doc = EN(text, tag=True) + doc.from_array([HEAD], numpy.asarray([[1, 0, 1, -2, -3, -1, -5]], dtype='int32').T) + # full method parse_tree(text) is a trivial composition + trees = EN.parse_tree_(doc) assert len(trees) > 0 tree = trees[0] assert all(k in list(tree.keys()) for k in ['word', 'lemma', 'NE', 'POS_fine', 'POS_coarse', 'arc', 'modifiers']) + assert tree['word'] == 'like' # check root is correct