From 0e8c41ea4fd913e3a9f77ccbd37182a6c6d42258 Mon Sep 17 00:00:00 2001 From: Gregory Howard Date: Wed, 3 May 2017 12:14:42 +0200 Subject: [PATCH] Adding method lemmatizer for every class --- spacy/de/__init__.py | 6 ++++++ spacy/es/__init__.py | 4 +++- spacy/hu/__init__.py | 7 ++++++- spacy/it/__init__.py | 8 +++++++- spacy/pt/__init__.py | 7 ++++++- spacy/sv/__init__.py | 7 ++++++- 6 files changed, 34 insertions(+), 5 deletions(-) diff --git a/spacy/de/__init__.py b/spacy/de/__init__.py index 9cec1520d..bf2f1ad0a 100644 --- a/spacy/de/__init__.py +++ b/spacy/de/__init__.py @@ -7,6 +7,8 @@ from ..language import Language from ..attrs import LANG from .language_data import * +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class German(Language): @@ -21,5 +23,9 @@ class German(Language): tag_map = TAG_MAP stop_words = STOP_WORDS + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOK_UP) + EXPORT = German \ No newline at end of file diff --git a/spacy/es/__init__.py b/spacy/es/__init__.py index 17ab34d83..0a22cc711 100644 --- a/spacy/es/__init__.py +++ b/spacy/es/__init__.py @@ -7,7 +7,8 @@ from ..language import Language from ..attrs import LANG from .language_data import * - +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class Spanish(Language): lang = 'es' @@ -21,4 +22,5 @@ class Spanish(Language): stop_words = STOP_WORDS + EXPORT = Spanish \ No newline at end of file diff --git a/spacy/hu/__init__.py b/spacy/hu/__init__.py index 77fff7743..10c429c44 100644 --- a/spacy/hu/__init__.py +++ b/spacy/hu/__init__.py @@ -5,7 +5,8 @@ from .tokenizer_exceptions import TOKEN_MATCH from .language_data import * from ..attrs import LANG from ..language import Language - +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class Hungarian(Language): lang = 'hu' @@ -25,5 +26,9 @@ class Hungarian(Language): token_match = TOKEN_MATCH + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOK_UP) + EXPORT = Hungarian \ No newline at end of file diff --git a/spacy/it/__init__.py b/spacy/it/__init__.py index a797ba9a1..d796045e9 100644 --- a/spacy/it/__init__.py +++ b/spacy/it/__init__.py @@ -5,7 +5,8 @@ from ..language import Language from ..attrs import LANG from .language_data import * - +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class Italian(Language): lang = 'it' @@ -17,5 +18,10 @@ class Italian(Language): tokenizer_exceptions = TOKENIZER_EXCEPTIONS stop_words = STOP_WORDS + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOK_UP) + + EXPORT = Italian \ No newline at end of file diff --git a/spacy/pt/__init__.py b/spacy/pt/__init__.py index 504a54029..e473e0d23 100644 --- a/spacy/pt/__init__.py +++ b/spacy/pt/__init__.py @@ -5,7 +5,8 @@ from ..language import Language from ..attrs import LANG from .language_data import * - +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class Portuguese(Language): lang = 'pt' @@ -17,5 +18,9 @@ class Portuguese(Language): tokenizer_exceptions = TOKENIZER_EXCEPTIONS stop_words = STOP_WORDS + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOK_UP) + EXPORT = Portuguese \ No newline at end of file diff --git a/spacy/sv/__init__.py b/spacy/sv/__init__.py index bd37c06b2..023c8a956 100644 --- a/spacy/sv/__init__.py +++ b/spacy/sv/__init__.py @@ -4,7 +4,8 @@ from __future__ import unicode_literals, print_function from ..language import Language from ..attrs import LANG from .language_data import * - +from ..lemmatizerlookup import Lemmatizer +from .lemmatization import LOOK_UP class Swedish(Language): lang = 'sv' @@ -16,5 +17,9 @@ class Swedish(Language): tokenizer_exceptions = TOKENIZER_EXCEPTIONS stop_words = STOP_WORDS + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOK_UP) + EXPORT = Swedish \ No newline at end of file