spaCy/spacy/tests/parser/test_ner.py

19 lines
616 B
Python
Raw Normal View History

2015-07-22 23:19:11 +00:00
import pytest
2015-04-13 19:33:54 +00:00
2015-07-22 23:19:11 +00:00
@pytest.mark.models
def test_simple_types(EN):
tokens = EN(u'Mr. Best flew to New York on Saturday morning.')
2015-04-13 19:33:54 +00:00
ents = list(tokens.ents)
assert ents[0].start == 1
assert ents[0].end == 2
assert ents[0].label_ == 'PERSON'
assert ents[1].start == 4
assert ents[1].end == 6
assert ents[1].label_ == 'GPE'
2015-11-08 12:57:15 +00:00
@pytest.mark.models
def test_consistency_bug(EN):
'''Test an arbitrary sequence-consistency bug encountered during speed test'''
tokens = EN(u'Where rap essentially went mainstream, illustrated by seminal Public Enemy, Beastie Boys and L.L. Cool J. tracks.')