mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Add test for Issue #955
This commit is contained in:
parent
60703cede5
commit
874a3cbb07
20
spacy/tests/regression/test_issue995.py
Normal file
20
spacy/tests/regression/test_issue995.py
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
import pytest
|
||||||
|
from ... import load as load_spacy
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def doc():
|
||||||
|
nlp = load_spacy('en')
|
||||||
|
return nlp('Does flight number three fifty-four require a connecting flight'
|
||||||
|
' to get to Boston?')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.models
|
||||||
|
def test_issue955(doc):
|
||||||
|
'''Test that we don't have any nested noun chunks'''
|
||||||
|
seen_tokens = set()
|
||||||
|
for np in doc.noun_chunks:
|
||||||
|
print(np.text, np.root.text, np.root.dep_, np.root.tag_)
|
||||||
|
for word in np:
|
||||||
|
key = (word.i, word.text)
|
||||||
|
assert key not in seen_tokens
|
||||||
|
seen_tokens.add(key)
|
Loading…
Reference in New Issue
Block a user