Add factory for experimental SimilarityHook component

This commit is contained in:
Matthew Honnibal 2017-06-05 15:40:22 +02:00
parent d59fa32df1
commit 836bfa2d0f

View File

@ -17,9 +17,12 @@ from .tagger import Tagger
from .lemmatizer import Lemmatizer from .lemmatizer import Lemmatizer
from .syntax.parser import get_templates from .syntax.parser import get_templates
from .syntax import nonproj from .syntax import nonproj
from .pipeline import NeuralDependencyParser, EntityRecognizer from .pipeline import NeuralDependencyParser, EntityRecognizer
from .pipeline import TokenVectorEncoder, NeuralTagger, NeuralEntityRecognizer from .pipeline import TokenVectorEncoder, NeuralTagger, NeuralEntityRecognizer
from .pipeline import NeuralLabeller from .pipeline import NeuralLabeller
from .pipeline import SimilarityHook
from .compat import json_dumps from .compat import json_dumps
from .attrs import IS_STOP from .attrs import IS_STOP
from .lang.punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES from .lang.punctuation import TOKENIZER_PREFIXES, TOKENIZER_SUFFIXES, TOKENIZER_INFIXES
@ -112,6 +115,7 @@ class BaseDefaults(object):
nonproj.deprojectivize, nonproj.deprojectivize,
], ],
'entities': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)], 'entities': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)],
'similarity': lambda nlp, **cfg: [SimilarityHook(nlp.vocab, **cfg)]
} }
token_match = TOKEN_MATCH token_match = TOKEN_MATCH