mirror of
https://github.com/explosion/spaCy.git
synced 2025-04-27 20:33:42 +03:00
Regression test for lemmatizer exceptions -- demonstrate issue #1387
This commit is contained in:
parent
678651ca98
commit
e81a608173
22
spacy/tests/regression/test_issue1387.py
Normal file
22
spacy/tests/regression/test_issue1387.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# coding: utf-8
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from ...symbols import POS, VERB, VerbForm_part
|
||||||
|
from ...vocab import Vocab
|
||||||
|
from ...lemmatizer import Lemmatizer
|
||||||
|
from ..util import get_doc
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
def test_issue1387():
|
||||||
|
tag_map = {'VBG': {POS: VERB, VerbForm_part: True}}
|
||||||
|
index = {"verb": ("cope","cop")}
|
||||||
|
exc = {"verb": {"coping": ("cope",)}}
|
||||||
|
rules = {"verb": [["ing", ""]]}
|
||||||
|
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