Add text categorizer to Language

This commit is contained in:
Matthew Honnibal 2017-07-22 01:13:36 +02:00
parent a6a2159969
commit baa3d81c35
1 changed files with 3 additions and 1 deletions

View File

@ -22,6 +22,7 @@ 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 .pipeline import SimilarityHook
from .pipeline import TextCategorizer
from .compat import json_dumps from .compat import json_dumps
from .attrs import IS_STOP from .attrs import IS_STOP
@ -107,6 +108,8 @@ class BaseDefaults(object):
NeuralDependencyParser(nlp.vocab, **cfg), NeuralDependencyParser(nlp.vocab, **cfg),
nonproj.deprojectivize], nonproj.deprojectivize],
'ner': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)], 'ner': lambda nlp, **cfg: [NeuralEntityRecognizer(nlp.vocab, **cfg)],
'similarity': lambda nlp, **cfg: [SimilarityHook(nlp.vocab, **cfg)],
'textcat': lambda nlp, **cfg: [TextCategorizer(nlp.vocab, **cfg)],
# Temporary compatibility -- delete after pivot # Temporary compatibility -- delete after pivot
'token_vectors': lambda nlp, **cfg: [TokenVectorEncoder(nlp.vocab, **cfg)], 'token_vectors': lambda nlp, **cfg: [TokenVectorEncoder(nlp.vocab, **cfg)],
'tags': lambda nlp, **cfg: [NeuralTagger(nlp.vocab, **cfg)], 'tags': lambda nlp, **cfg: [NeuralTagger(nlp.vocab, **cfg)],
@ -115,7 +118,6 @@ 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