Move LookupLemmatizer to spacy.lemmatizer

This commit is contained in:
ines 2017-10-11 02:25:13 +02:00
parent 417d45f5d0
commit 820bf85075
2 changed files with 15 additions and 19 deletions

View File

@ -100,3 +100,18 @@ def lemmatize(string, index, exceptions, rules):
if not forms: if not forms:
forms.append(string) forms.append(string)
return set(forms) return set(forms)
class LookupLemmatizer(Lemmatizer):
@classmethod
def load(cls, path, lookup):
return cls(lookup or {})
def __init__(self, lookup):
self.lookup = lookup
def __call__(self, string, univ_pos, morphology=None):
try:
return set([self.lookup[string]])
except:
return set([string])

View File

@ -1,19 +0,0 @@
# coding: utf8
from __future__ import unicode_literals
from .lemmatizer import Lemmatizer
class Lemmatizer(Lemmatizer):
@classmethod
def load(cls, path, lookup):
return cls(lookup or {})
def __init__(self, lookup):
self.lookup = lookup
def __call__(self, string, univ_pos, morphology=None):
try:
return set([self.lookup[string]])
except:
return set([string])