mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 17:24:41 +03:00
Unit test for lemmatizer exceptions -- copied from regression test for #1387
This commit is contained in:
parent
ffb50d21a0
commit
b0d271809d
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue
Block a user