Fix displaCy test

This commit is contained in:
ines 2017-11-22 04:19:28 +01:00
parent 93b0be611a
commit a6f33ac27d
1 changed files with 6 additions and 6 deletions

View File

@ -48,15 +48,15 @@ def test_displacy_parse_deps(en_vocab):
"""Test that deps and tags on a Doc are converted into displaCy's format.""" """Test that deps and tags on a Doc are converted into displaCy's format."""
words = ["This", "is", "a", "sentence"] words = ["This", "is", "a", "sentence"]
heads = [1, 0, 1, -2] heads = [1, 0, 1, -2]
tags = ['DT', 'VBZ', 'DT', 'NN'] pos = ['DET', 'VERB', 'DET', 'NOUN']
deps = ['nsubj', 'ROOT', 'det', 'attr'] deps = ['nsubj', 'ROOT', 'det', 'attr']
doc = get_doc(en_vocab, words=words, heads=heads, tags=tags, deps=deps) doc = get_doc(en_vocab, words=words, heads=heads, pos=pos, deps=deps)
deps = parse_deps(doc) deps = parse_deps(doc)
assert isinstance(deps, dict) assert isinstance(deps, dict)
assert deps['words'] == [{'text': 'This', 'tag': 'DT'}, assert deps['words'] == [{'text': 'This', 'tag': 'DET'},
{'text': 'is', 'tag': 'VBZ'}, {'text': 'is', 'tag': 'VERB'},
{'text': 'a', 'tag': 'DT'}, {'text': 'a', 'tag': 'DET'},
{'text': 'sentence', 'tag': 'NN'}] {'text': 'sentence', 'tag': 'NOUN'}]
assert deps['arcs'] == [{'start': 0, 'end': 1, 'label': 'nsubj', 'dir': 'left'}, assert deps['arcs'] == [{'start': 0, 'end': 1, 'label': 'nsubj', 'dir': 'left'},
{'start': 2, 'end': 3, 'label': 'det', 'dir': 'left'}, {'start': 2, 'end': 3, 'label': 'det', 'dir': 'left'},
{'start': 1, 'end': 3, 'label': 'attr', 'dir': 'right'}] {'start': 1, 'end': 3, 'label': 'attr', 'dir': 'right'}]