Unit test for lemmatizer exceptions -- copied from regression test for #1387

This commit is contained in:
Orion Montoya 2017-10-05 10:49:28 -04:00
parent ffb50d21a0
commit b0d271809d

View File

@ -47,3 +47,20 @@ def test_tagger_lemmatizer_lemma_assignment(EN):
assert all(t.lemma_ == '' for t in doc)
EN.tagger(doc)
assert all(t.lemma_ != '' for t in doc)
from ...symbols import POS, VERB, VerbForm_part
from ...vocab import Vocab
from ...lemmatizer import Lemmatizer
from ..util import get_doc
def test_tagger_lemmatizer_exceptions():
index = {"verb": ("cope","cop")}
exc = {"verb": {"coping": ("cope",)}}
rules = {"verb": [["ing", ""]]}
tag_map = {'VBG': {POS: VERB, VerbForm_part: True}}
lemmatizer = Lemmatizer(index, exc, rules)
vocab = Vocab(lemmatizer=lemmatizer, tag_map=tag_map)
doc = get_doc(vocab, ["coping"])
doc[0].tag_ = 'VBG'
assert doc[0].text == "coping"
assert doc[0].lemma_ == "cope"