From 8815507f8e334238d269468e08c22f4415e58528 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 18 May 2017 04:28:51 -0500 Subject: [PATCH] Move SpanishDefaults out of Language class, for pickle --- spacy/lang/es/__init__.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/spacy/lang/es/__init__.py b/spacy/lang/es/__init__.py index 6b56982ba..f5735d460 100644 --- a/spacy/lang/es/__init__.py +++ b/spacy/lang/es/__init__.py @@ -13,20 +13,22 @@ from ...attrs import LANG from ...util import update_exc +class SpanishDefaults(Language.Defaults): + lex_attr_getters = dict(Language.Defaults.lex_attr_getters) + lex_attr_getters[LANG] = lambda text: 'es' + + tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) + tag_map = dict(TAG_MAP) + stop_words = set(STOP_WORDS) + + @classmethod + def create_lemmatizer(cls, nlp=None): + return Lemmatizer(LOOKUP) + + class Spanish(Language): lang = 'es' - class Defaults(Language.Defaults): - lex_attr_getters = dict(Language.Defaults.lex_attr_getters) - lex_attr_getters[LANG] = lambda text: 'es' - - tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) - tag_map = dict(TAG_MAP) - stop_words = set(STOP_WORDS) - - @classmethod - def create_lemmatizer(cls, nlp=None): - return Lemmatizer(LOOKUP) - + Defaults = SpanishDefaults __all__ = ['Spanish']