From 839de87ca99b1469a0305ded10a7b99abd7a4df7 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Tue, 17 Oct 2017 18:21:20 +0200 Subject: [PATCH] Make lambda func a named function, for pickling --- spacy/lang/en/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/lang/en/__init__.py b/spacy/lang/en/__init__.py index 63fd9c2b4..a95e501e1 100644 --- a/spacy/lang/en/__init__.py +++ b/spacy/lang/en/__init__.py @@ -16,11 +16,13 @@ from ...language import Language from ...attrs import LANG, NORM from ...util import update_exc, add_lookups +def _return_en(_): + return 'en' class EnglishDefaults(Language.Defaults): lex_attr_getters = dict(Language.Defaults.lex_attr_getters) lex_attr_getters.update(LEX_ATTRS) - lex_attr_getters[LANG] = lambda text: 'en' + lex_attr_getters[LANG] = _return_en lex_attr_getters[NORM] = add_lookups(Language.Defaults.lex_attr_getters[NORM], BASE_NORMS, NORM_EXCEPTIONS) tokenizer_exceptions = update_exc(BASE_EXCEPTIONS, TOKENIZER_EXCEPTIONS)