spaCy/spacy/lemmatizerlookup.py
ghoward 55c6910f90 Look_up table for languages in spacy.
Need to find an another name for lemmatizerlookup. I was not inspired.
Trying to uses new files in fr language.
2017-04-24 16:39:00 +02:00

21 lines
475 B
Python

# 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):
print("Mon lemmatizer")
self.lookup = lookup
def __call__(self, string, univ_pos, morphology=None):
print("call")
try:
return self.lookup[string]
except:
return string