From 61fe55efba2c491da6a93421fa702f123615bc32 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sat, 20 May 2017 02:18:19 -0500 Subject: [PATCH] Move EnglishDefaults class out of English --- spacy/lang/en/__init__.py | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/spacy/lang/en/__init__.py b/spacy/lang/en/__init__.py index 2d5314991..9f07d4024 100644 --- a/spacy/lang/en/__init__.py +++ b/spacy/lang/en/__init__.py @@ -15,22 +15,25 @@ from ...attrs import LANG from ...util import update_exc +class EnglishDefaults(Language.Defaults): + lex_attr_getters = dict(Language.Defaults.lex_attr_getters) + lex_attr_getters[LANG] = lambda text: 'en' + lex_attr_getters.update(LEX_ATTRS) + + tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) + tag_map = dict(TAG_MAP) + stop_words = set(STOP_WORDS) + morph_rules = dict(MORPH_RULES) + lemma_rules = dict(LEMMA_RULES) + lemma_index = dict(LEMMA_INDEX) + lemma_exc = dict(LEMMA_EXC) + sytax_iterators = dict(SYNTAX_ITERATORS) + + class English(Language): lang = 'en' - class Defaults(Language.Defaults): - lex_attr_getters = dict(Language.Defaults.lex_attr_getters) - lex_attr_getters[LANG] = lambda text: 'en' - lex_attr_getters.update(LEX_ATTRS) - - tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS) - tag_map = dict(TAG_MAP) - stop_words = set(STOP_WORDS) - morph_rules = dict(MORPH_RULES) - lemma_rules = dict(LEMMA_RULES) - lemma_index = dict(LEMMA_INDEX) - lemma_exc = dict(LEMMA_EXC) - sytax_iterators = dict(SYNTAX_ITERATORS) + Defaults = EnglishDefaults -__all__ = ['English'] +__all__ = ['English', 'EnglishDefaults']