From 0a62c32c14a798ef6b62b0d1ce7e334d3bd680ae Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 13 Apr 2015 21:33:54 +0200 Subject: [PATCH] * Add test for simple NER case --- tests/test_ner.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/test_ner.py diff --git a/tests/test_ner.py b/tests/test_ner.py new file mode 100644 index 000000000..bedca8a8e --- /dev/null +++ b/tests/test_ner.py @@ -0,0 +1,20 @@ +from spacy.en import English + + +nlp = English() + +def test_simple_types(): + tokens = nlp(u'Mr. Best flew to New York on Saturday morning.') + 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' + assert ents[2].start == 7 + assert ents[2].end == 8 + assert ents[2].label_ == 'DATE' + assert ents[3].start == 8 + assert ents[3].end == 9 + assert ents[3].label_ == 'TIME'