Add GreekLemmatizer.lookup (resolves #4272)

This commit is contained in:
Ines Montani 2019-09-11 11:44:40 +02:00
parent 6279d74c65
commit 8f9f48b04c
2 changed files with 17 additions and 0 deletions

View File

@ -46,6 +46,11 @@ class GreekLemmatizer(object):
)
return lemmas
def lookup(self, string):
if string in self.lookup_table:
return self.lookup_table[string]
return string
def lemmatize(string, index, exceptions, rules):
string = string.lower()

View File

@ -0,0 +1,12 @@
# coding: utf8
from __future__ import unicode_literals
from spacy.lang.el import Greek
def test_issue4272():
"""Test that lookup table can be accessed from Token.lemma if no POS tags
are available."""
nlp = Greek()
doc = nlp("Χθες")
assert doc[0].lemma_