2017-04-24 11:09:01 +03:00
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-04-23 18:57:01 +03:00
|
|
|
import pytest
|
|
|
|
|
|
|
|
|
2017-05-29 23:14:31 +03:00
|
|
|
@pytest.mark.models('en')
|
2017-06-05 00:00:44 +03:00
|
|
|
def test_issue955(EN):
|
2017-04-23 18:57:01 +03:00
|
|
|
'''Test that we don't have any nested noun chunks'''
|
2017-05-29 23:14:31 +03:00
|
|
|
doc = EN('Does flight number three fifty-four require a connecting flight'
|
|
|
|
' to get to Boston?')
|
2017-04-23 18:57:01 +03:00
|
|
|
seen_tokens = set()
|
|
|
|
for np in doc.noun_chunks:
|
|
|
|
for word in np:
|
|
|
|
key = (word.i, word.text)
|
|
|
|
assert key not in seen_tokens
|
|
|
|
seen_tokens.add(key)
|