From c89e30d1a33df2d9d8c5ceb03df98d29b3b08724 Mon Sep 17 00:00:00 2001 From: ines Date: Sun, 12 Mar 2017 13:44:20 +0100 Subject: [PATCH] Add test for English time exceptions ("1a.m." etc.) --- spacy/tests/en/test_exceptions.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spacy/tests/en/test_exceptions.py b/spacy/tests/en/test_exceptions.py index ac7ed452f..03e738a34 100644 --- a/spacy/tests/en/test_exceptions.py +++ b/spacy/tests/en/test_exceptions.py @@ -18,3 +18,10 @@ def test_tokenizer_handles_exc_in_text(en_tokenizer): tokens = en_tokenizer(text) assert len(tokens) == 6 assert tokens[3].text == "i.e." + + +@pytest.mark.parametrize('text', ["1am", "12a.m.", "11p.m.", "4pm"]) +def test_tokenizer_handles_times(en_tokenizer, text): + tokens = en_tokenizer(text) + assert len(tokens) == 2 + assert tokens[1].lemma_ in ["a.m.", "p.m."]