Adding method lemmatizer for every class

This commit is contained in:
Gregory Howard 2017-05-03 12:14:42 +02:00
parent 32ca07989e
commit 0e8c41ea4f
6 changed files with 34 additions and 5 deletions

View File

@ -7,6 +7,8 @@ from ..language import Language
from ..attrs import LANG from ..attrs import LANG
from .language_data import * from .language_data import *
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class German(Language): class German(Language):
@ -21,5 +23,9 @@ class German(Language):
tag_map = TAG_MAP tag_map = TAG_MAP
stop_words = STOP_WORDS stop_words = STOP_WORDS
@classmethod
def create_lemmatizer(cls, nlp=None):
return Lemmatizer(LOOK_UP)
EXPORT = German EXPORT = German

View File

@ -7,7 +7,8 @@ from ..language import Language
from ..attrs import LANG from ..attrs import LANG
from .language_data import * from .language_data import *
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class Spanish(Language): class Spanish(Language):
lang = 'es' lang = 'es'
@ -21,4 +22,5 @@ class Spanish(Language):
stop_words = STOP_WORDS stop_words = STOP_WORDS
EXPORT = Spanish EXPORT = Spanish

View File

@ -5,7 +5,8 @@ from .tokenizer_exceptions import TOKEN_MATCH
from .language_data import * from .language_data import *
from ..attrs import LANG from ..attrs import LANG
from ..language import Language from ..language import Language
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class Hungarian(Language): class Hungarian(Language):
lang = 'hu' lang = 'hu'
@ -25,5 +26,9 @@ class Hungarian(Language):
token_match = TOKEN_MATCH token_match = TOKEN_MATCH
@classmethod
def create_lemmatizer(cls, nlp=None):
return Lemmatizer(LOOK_UP)
EXPORT = Hungarian EXPORT = Hungarian

View File

@ -5,7 +5,8 @@ from ..language import Language
from ..attrs import LANG from ..attrs import LANG
from .language_data import * from .language_data import *
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class Italian(Language): class Italian(Language):
lang = 'it' lang = 'it'
@ -17,5 +18,10 @@ class Italian(Language):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS tokenizer_exceptions = TOKENIZER_EXCEPTIONS
stop_words = STOP_WORDS stop_words = STOP_WORDS
@classmethod
def create_lemmatizer(cls, nlp=None):
return Lemmatizer(LOOK_UP)
EXPORT = Italian EXPORT = Italian

View File

@ -5,7 +5,8 @@ from ..language import Language
from ..attrs import LANG from ..attrs import LANG
from .language_data import * from .language_data import *
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class Portuguese(Language): class Portuguese(Language):
lang = 'pt' lang = 'pt'
@ -17,5 +18,9 @@ class Portuguese(Language):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS tokenizer_exceptions = TOKENIZER_EXCEPTIONS
stop_words = STOP_WORDS stop_words = STOP_WORDS
@classmethod
def create_lemmatizer(cls, nlp=None):
return Lemmatizer(LOOK_UP)
EXPORT = Portuguese EXPORT = Portuguese

View File

@ -4,7 +4,8 @@ from __future__ import unicode_literals, print_function
from ..language import Language from ..language import Language
from ..attrs import LANG from ..attrs import LANG
from .language_data import * from .language_data import *
from ..lemmatizerlookup import Lemmatizer
from .lemmatization import LOOK_UP
class Swedish(Language): class Swedish(Language):
lang = 'sv' lang = 'sv'
@ -16,5 +17,9 @@ class Swedish(Language):
tokenizer_exceptions = TOKENIZER_EXCEPTIONS tokenizer_exceptions = TOKENIZER_EXCEPTIONS
stop_words = STOP_WORDS stop_words = STOP_WORDS
@classmethod
def create_lemmatizer(cls, nlp=None):
return Lemmatizer(LOOK_UP)
EXPORT = Swedish EXPORT = Swedish