mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 02:06:31 +03:00
Fix parse_tree test
This commit is contained in:
parent
6129016e15
commit
8c2a0c026d
|
@ -217,11 +217,13 @@ def test_doc_api_has_vector(en_tokenizer, text_file, text, vectors):
|
||||||
assert doc.has_vector
|
assert doc.has_vector
|
||||||
|
|
||||||
|
|
||||||
def test_parse_tree(EN):
|
def test_parse_tree(en_tokenizer):
|
||||||
|
"""Tests doc.print_tree() method."""
|
||||||
text = 'I like New York in Autumn.'
|
text = 'I like New York in Autumn.'
|
||||||
EN = English(parser=False)
|
heads = [1, 0, 1, -2, -3, -1, -5]
|
||||||
doc = EN(text, tag=True)
|
tags = ['PRP', 'IN', 'NNP', 'NNP', 'IN', 'NNP', '.']
|
||||||
doc.from_array([HEAD], numpy.asarray([[1, 0, 1, -2, -3, -1, -5]], dtype='int32').T)
|
tokens = en_tokenizer(text)
|
||||||
|
doc = get_doc(tokens.vocab, [t.text for t in tokens], heads=heads, tags=tags)
|
||||||
# full method parse_tree(text) is a trivial composition
|
# full method parse_tree(text) is a trivial composition
|
||||||
trees = doc.print_tree()
|
trees = doc.print_tree()
|
||||||
assert len(trees) > 0
|
assert len(trees) > 0
|
||||||
|
|
Loading…
Reference in New Issue
Block a user