From f00de445dd04b61bc55a0fe010c9cd3862d38aef Mon Sep 17 00:00:00 2001 From: Sofie Van Landeghem Date: Tue, 19 May 2020 16:20:03 +0200 Subject: [PATCH] default models defined in component decorator (#5452) * move defaults to pipeline and use in component decorator * black formatting * relative import --- spacy/language.py | 54 +++++++------------ .../models => pipeline}/defaults/__init__.py | 2 +- .../defaults/entity_linker_defaults.cfg | 0 .../defaults/morphologizer_defaults.cfg | 0 .../defaults/ner_defaults.cfg | 0 .../defaults/parser_defaults.cfg | 0 .../defaults/senter_defaults.cfg | 0 .../defaults/simple_ner_defaults.cfg | 0 .../defaults/tagger_defaults.cfg | 0 .../defaults/tensorizer_defaults.cfg | 0 .../defaults/textcat_bow_defaults.cfg | 0 .../defaults/textcat_cnn_defaults.cfg | 0 .../defaults/textcat_defaults.cfg | 0 .../defaults/tok2vec_defaults.cfg | 0 spacy/pipeline/morphologizer.pyx | 3 +- spacy/pipeline/pipes.pyx | 29 +++++++--- spacy/pipeline/simple_ner.py | 4 +- spacy/pipeline/tok2vec.py | 3 +- spacy/tests/doc/test_add_entities.py | 2 +- spacy/tests/parser/test_add_label.py | 2 +- spacy/tests/parser/test_arc_eager_oracle.py | 2 +- spacy/tests/parser/test_ner.py | 2 +- spacy/tests/parser/test_neural_parser.py | 2 +- spacy/tests/parser/test_nn_beam.py | 2 +- spacy/tests/parser/test_preset_sbd.py | 2 +- spacy/tests/pipeline/test_textcat.py | 2 +- spacy/tests/regression/test_issue1501-2000.py | 2 +- spacy/tests/regression/test_issue3001-3500.py | 2 +- spacy/tests/regression/test_issue3830.py | 2 +- spacy/tests/regression/test_issue4042.py | 2 +- spacy/tests/regression/test_issue4313.py | 2 +- .../serialize/test_serialize_pipeline.py | 4 +- 32 files changed, 64 insertions(+), 61 deletions(-) rename spacy/{ml/models => pipeline}/defaults/__init__.py (99%) rename spacy/{ml/models => pipeline}/defaults/entity_linker_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/morphologizer_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/ner_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/parser_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/senter_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/simple_ner_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/tagger_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/tensorizer_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/textcat_bow_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/textcat_cnn_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/textcat_defaults.cfg (100%) rename spacy/{ml/models => pipeline}/defaults/tok2vec_defaults.cfg (100%) diff --git a/spacy/language.py b/spacy/language.py index 5f617b1f6..2b8fa129e 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -184,33 +184,6 @@ class Language(object): self.max_length = max_length self._optimizer = None - # TODO: de-uglify (incorporating into component decorator didn't work because of circular imports) - from .ml.models.defaults import ( - default_tagger_config, - default_parser_config, - default_ner_config, - default_textcat_config, - default_nel_config, - default_morphologizer_config, - default_senter_config, - default_tensorizer_config, - default_tok2vec_config, - default_simple_ner_config - ) - - self.defaults = { - "tagger": default_tagger_config(), - "parser": default_parser_config(), - "ner": default_ner_config(), - "textcat": default_textcat_config(), - "entity_linker": default_nel_config(), - "morphologizer": default_morphologizer_config(), - "senter": default_senter_config(), - "simple_ner": default_simple_ner_config(), - "tensorizer": default_tensorizer_config(), - "tok2vec": default_tok2vec_config(), - } - @property def path(self): return self._path @@ -338,7 +311,6 @@ class Language(object): else: raise KeyError(Errors.E002.format(name=name)) factory = self.factories[name] - default_config = self.defaults.get(name, None) # transform the model's config to an actual Model factory_cfg = dict(config) @@ -349,11 +321,6 @@ class Language(object): warnings.warn(Warnings.W099.format(type=type(model_cfg), pipe=name)) model_cfg = None del factory_cfg["model"] - if model_cfg is None and default_config is not None: - warnings.warn(Warnings.W098.format(name=name)) - model_cfg = default_config["model"] - if model_cfg is None: - warnings.warn(Warnings.W097.format(name=name)) model = None if model_cfg is not None: self.config[name] = {"model": model_cfg} @@ -539,7 +506,11 @@ class Language(object): to_disable = [pipe for pipe in self.pipe_names if pipe not in enable] # raise an error if the enable and disable keywords are not consistent if disable is not None and disable != to_disable: - raise ValueError(Errors.E992.format(enable=enable, disable=disable, names=self.pipe_names)) + raise ValueError( + Errors.E992.format( + enable=enable, disable=disable, names=self.pipe_names + ) + ) disable = to_disable return DisabledPipes(self, disable) @@ -1085,7 +1056,14 @@ class component(object): # NB: This decorator needs to live here, because it needs to write to # Language.factories. All other solutions would cause circular import. - def __init__(self, name=None, assigns=tuple(), requires=tuple(), retokenizes=False): + def __init__( + self, + name=None, + assigns=tuple(), + requires=tuple(), + retokenizes=False, + default_model=lambda: None, + ): """Decorate a pipeline component. name (unicode): Default component and factory name. @@ -1097,6 +1075,7 @@ class component(object): self.assigns = validate_attrs(assigns) self.requires = validate_attrs(requires) self.retokenizes = retokenizes + self.default_model = default_model def __call__(self, *args, **kwargs): obj = args[0] @@ -1109,6 +1088,11 @@ class component(object): obj.retokenizes = self.retokenizes def factory(nlp, model, **cfg): + if model is None: + model = self.default_model() + warnings.warn(Warnings.W098.format(name=self.name)) + if model is None: + warnings.warn(Warnings.W097.format(name=self.name)) if hasattr(obj, "from_nlp"): return obj.from_nlp(nlp, model, **cfg) elif isinstance(obj, type): diff --git a/spacy/ml/models/defaults/__init__.py b/spacy/pipeline/defaults/__init__.py similarity index 99% rename from spacy/ml/models/defaults/__init__.py rename to spacy/pipeline/defaults/__init__.py index 850d9fce0..e17e2d3b4 100644 --- a/spacy/ml/models/defaults/__init__.py +++ b/spacy/pipeline/defaults/__init__.py @@ -1,6 +1,6 @@ from pathlib import Path -from .... import util +from ... import util def default_nel_config(): diff --git a/spacy/ml/models/defaults/entity_linker_defaults.cfg b/spacy/pipeline/defaults/entity_linker_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/entity_linker_defaults.cfg rename to spacy/pipeline/defaults/entity_linker_defaults.cfg diff --git a/spacy/ml/models/defaults/morphologizer_defaults.cfg b/spacy/pipeline/defaults/morphologizer_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/morphologizer_defaults.cfg rename to spacy/pipeline/defaults/morphologizer_defaults.cfg diff --git a/spacy/ml/models/defaults/ner_defaults.cfg b/spacy/pipeline/defaults/ner_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/ner_defaults.cfg rename to spacy/pipeline/defaults/ner_defaults.cfg diff --git a/spacy/ml/models/defaults/parser_defaults.cfg b/spacy/pipeline/defaults/parser_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/parser_defaults.cfg rename to spacy/pipeline/defaults/parser_defaults.cfg diff --git a/spacy/ml/models/defaults/senter_defaults.cfg b/spacy/pipeline/defaults/senter_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/senter_defaults.cfg rename to spacy/pipeline/defaults/senter_defaults.cfg diff --git a/spacy/ml/models/defaults/simple_ner_defaults.cfg b/spacy/pipeline/defaults/simple_ner_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/simple_ner_defaults.cfg rename to spacy/pipeline/defaults/simple_ner_defaults.cfg diff --git a/spacy/ml/models/defaults/tagger_defaults.cfg b/spacy/pipeline/defaults/tagger_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/tagger_defaults.cfg rename to spacy/pipeline/defaults/tagger_defaults.cfg diff --git a/spacy/ml/models/defaults/tensorizer_defaults.cfg b/spacy/pipeline/defaults/tensorizer_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/tensorizer_defaults.cfg rename to spacy/pipeline/defaults/tensorizer_defaults.cfg diff --git a/spacy/ml/models/defaults/textcat_bow_defaults.cfg b/spacy/pipeline/defaults/textcat_bow_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/textcat_bow_defaults.cfg rename to spacy/pipeline/defaults/textcat_bow_defaults.cfg diff --git a/spacy/ml/models/defaults/textcat_cnn_defaults.cfg b/spacy/pipeline/defaults/textcat_cnn_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/textcat_cnn_defaults.cfg rename to spacy/pipeline/defaults/textcat_cnn_defaults.cfg diff --git a/spacy/ml/models/defaults/textcat_defaults.cfg b/spacy/pipeline/defaults/textcat_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/textcat_defaults.cfg rename to spacy/pipeline/defaults/textcat_defaults.cfg diff --git a/spacy/ml/models/defaults/tok2vec_defaults.cfg b/spacy/pipeline/defaults/tok2vec_defaults.cfg similarity index 100% rename from spacy/ml/models/defaults/tok2vec_defaults.cfg rename to spacy/pipeline/defaults/tok2vec_defaults.cfg diff --git a/spacy/pipeline/morphologizer.pyx b/spacy/pipeline/morphologizer.pyx index 7a2bc3b17..c45a72b25 100644 --- a/spacy/pipeline/morphologizer.pyx +++ b/spacy/pipeline/morphologizer.pyx @@ -17,9 +17,10 @@ from ..util import link_vectors_to_models, create_default_optimizer from ..errors import Errors, TempErrors from .pipes import Tagger, _load_cfg from .. import util +from .defaults import default_morphologizer -@component("morphologizer", assigns=["token.morph", "token.pos"]) +@component("morphologizer", assigns=["token.morph", "token.pos"], default_model=default_morphologizer) class Morphologizer(Tagger): def __init__(self, vocab, model, **cfg): diff --git a/spacy/pipeline/pipes.pyx b/spacy/pipeline/pipes.pyx index 61db11baa..4ff956e1d 100644 --- a/spacy/pipeline/pipes.pyx +++ b/spacy/pipeline/pipes.pyx @@ -2,6 +2,7 @@ import numpy import srsly import random + from thinc.api import CosineDistance, to_categorical, get_array_module from thinc.api import set_dropout_rate, SequenceCategoricalCrossentropy import warnings @@ -13,6 +14,8 @@ from ..syntax.arc_eager cimport ArcEager from ..morphology cimport Morphology from ..vocab cimport Vocab +from .defaults import default_tagger, default_parser, default_ner, default_textcat +from .defaults import default_nel, default_senter, default_tensorizer from .functions import merge_subtokens from ..language import Language, component from ..syntax import nonproj @@ -234,7 +237,7 @@ class Pipe(object): return self -@component("tensorizer", assigns=["doc.tensor"]) +@component("tensorizer", assigns=["doc.tensor"], default_model=default_tensorizer) class Tensorizer(Pipe): """Pre-train position-sensitive vectors for tokens.""" @@ -366,7 +369,7 @@ class Tensorizer(Pipe): return sgd -@component("tagger", assigns=["token.tag", "token.pos", "token.lemma"]) +@component("tagger", assigns=["token.tag", "token.pos", "token.lemma"], default_model=default_tagger) class Tagger(Pipe): """Pipeline component for part-of-speech tagging. @@ -636,7 +639,7 @@ class Tagger(Pipe): return self -@component("senter", assigns=["token.is_sent_start"]) +@component("senter", assigns=["token.is_sent_start"], default_model=default_senter) class SentenceRecognizer(Tagger): """Pipeline component for sentence segmentation. @@ -976,7 +979,7 @@ class ClozeMultitask(Pipe): losses[self.name] += loss -@component("textcat", assigns=["doc.cats"]) +@component("textcat", assigns=["doc.cats"], default_model=default_textcat) class TextCategorizer(Pipe): """Pipeline component for text classification. @@ -1227,7 +1230,8 @@ cdef class EntityRecognizer(Parser): @component( "entity_linker", requires=["doc.ents", "doc.sents", "token.ent_iob", "token.ent_type"], - assigns=["token.ent_kb_id"] + assigns=["token.ent_kb_id"], + default_model=default_nel, ) class EntityLinker(Pipe): """Pipeline component for named entity linking. @@ -1673,8 +1677,19 @@ class Sentencizer(Pipe): # Cython classes can't be decorated, so we need to add the factories here -Language.factories["parser"] = lambda nlp, model, **cfg: DependencyParser.from_nlp(nlp, model, **cfg) -Language.factories["ner"] = lambda nlp, model, **cfg: EntityRecognizer.from_nlp(nlp, model, **cfg) +Language.factories["parser"] = lambda nlp, model, **cfg: parser_factory(nlp, model, **cfg) +Language.factories["ner"] = lambda nlp, model, **cfg: ner_factory(nlp, model, **cfg) +def parser_factory(nlp, model, **cfg): + if model is None: + model = default_parser() + warnings.warn(Warnings.W098.format(name="parser")) + return DependencyParser.from_nlp(nlp, model, **cfg) + +def ner_factory(nlp, model, **cfg): + if model is None: + model = default_ner() + warnings.warn(Warnings.W098.format(name="ner")) + return EntityRecognizer.from_nlp(nlp, model, **cfg) __all__ = ["Tagger", "DependencyParser", "EntityRecognizer", "Tensorizer", "TextCategorizer", "EntityLinker", "Sentencizer", "SentenceRecognizer"] diff --git a/spacy/pipeline/simple_ner.py b/spacy/pipeline/simple_ner.py index 8d53152d8..c674046af 100644 --- a/spacy/pipeline/simple_ner.py +++ b/spacy/pipeline/simple_ner.py @@ -2,6 +2,8 @@ from typing import List from thinc.types import Floats2d from thinc.api import SequenceCategoricalCrossentropy, set_dropout_rate from thinc.util import to_numpy + +from .defaults import default_simple_ner from ..gold import Example, spans_from_biluo_tags, iob_to_biluo, biluo_to_iob from ..tokens import Doc from ..language import component @@ -9,7 +11,7 @@ from ..util import link_vectors_to_models from .pipes import Pipe -@component("simple_ner", assigns=["doc.ents"]) +@component("simple_ner", assigns=["doc.ents"], default_model=default_simple_ner) class SimpleNER(Pipe): """Named entity recognition with a tagging model. The model should include validity constraints to ensure that only valid tag sequences are returned.""" diff --git a/spacy/pipeline/tok2vec.py b/spacy/pipeline/tok2vec.py index 83a4454e3..5882fa266 100644 --- a/spacy/pipeline/tok2vec.py +++ b/spacy/pipeline/tok2vec.py @@ -6,9 +6,10 @@ from ..tokens import Doc from ..vocab import Vocab from ..language import component from ..util import link_vectors_to_models, minibatch, eg2doc +from .defaults import default_tok2vec -@component("tok2vec", assigns=["doc.tensor"]) +@component("tok2vec", assigns=["doc.tensor"], default_model=default_tok2vec) class Tok2Vec(Pipe): @classmethod def from_nlp(cls, nlp, model, **cfg): diff --git a/spacy/tests/doc/test_add_entities.py b/spacy/tests/doc/test_add_entities.py index 3a466b24c..c92fc1ff9 100644 --- a/spacy/tests/doc/test_add_entities.py +++ b/spacy/tests/doc/test_add_entities.py @@ -3,7 +3,7 @@ from spacy.tokens import Span import pytest from ..util import get_doc -from ...ml.models.defaults import default_ner +from spacy.pipeline.defaults import default_ner def test_doc_add_entities_set_ents_iob(en_vocab): diff --git a/spacy/tests/parser/test_add_label.py b/spacy/tests/parser/test_add_label.py index 39682ba3d..ee1bba886 100644 --- a/spacy/tests/parser/test_add_label.py +++ b/spacy/tests/parser/test_add_label.py @@ -4,7 +4,7 @@ from spacy.attrs import NORM from spacy.gold import GoldParse from spacy.vocab import Vocab -from spacy.ml.models.defaults import default_parser, default_ner +from spacy.pipeline.defaults import default_parser, default_ner from spacy.tokens import Doc from spacy.pipeline import DependencyParser, EntityRecognizer from spacy.util import fix_random_seed diff --git a/spacy/tests/parser/test_arc_eager_oracle.py b/spacy/tests/parser/test_arc_eager_oracle.py index 2426805d2..30b4a6f6d 100644 --- a/spacy/tests/parser/test_arc_eager_oracle.py +++ b/spacy/tests/parser/test_arc_eager_oracle.py @@ -1,7 +1,7 @@ import pytest from spacy.vocab import Vocab -from spacy.ml.models.defaults import default_parser +from spacy.pipeline.defaults import default_parser from spacy.pipeline import DependencyParser from spacy.tokens import Doc from spacy.gold import GoldParse diff --git a/spacy/tests/parser/test_ner.py b/spacy/tests/parser/test_ner.py index 2fd87ead3..9656d3a10 100644 --- a/spacy/tests/parser/test_ner.py +++ b/spacy/tests/parser/test_ner.py @@ -2,7 +2,7 @@ import pytest from spacy import util from spacy.lang.en import English -from spacy.ml.models.defaults import default_ner +from spacy.pipeline.defaults import default_ner from spacy.pipeline import EntityRecognizer, EntityRuler from spacy.vocab import Vocab diff --git a/spacy/tests/parser/test_neural_parser.py b/spacy/tests/parser/test_neural_parser.py index c985cf87a..b648e9a00 100644 --- a/spacy/tests/parser/test_neural_parser.py +++ b/spacy/tests/parser/test_neural_parser.py @@ -1,5 +1,5 @@ import pytest -from spacy.ml.models.defaults import default_parser, default_tok2vec +from spacy.pipeline.defaults import default_parser, default_tok2vec from spacy.vocab import Vocab from spacy.syntax.arc_eager import ArcEager from spacy.syntax.nn_parser import Parser diff --git a/spacy/tests/parser/test_nn_beam.py b/spacy/tests/parser/test_nn_beam.py index 619e0cc0b..db9eb5e6f 100644 --- a/spacy/tests/parser/test_nn_beam.py +++ b/spacy/tests/parser/test_nn_beam.py @@ -2,7 +2,7 @@ import pytest import numpy from spacy.vocab import Vocab from spacy.language import Language -from spacy.ml.models.defaults import default_parser +from spacy.pipeline.defaults import default_parser from spacy.pipeline import DependencyParser from spacy.syntax.arc_eager import ArcEager from spacy.tokens import Doc diff --git a/spacy/tests/parser/test_preset_sbd.py b/spacy/tests/parser/test_preset_sbd.py index af777aa6b..dc13fcdf1 100644 --- a/spacy/tests/parser/test_preset_sbd.py +++ b/spacy/tests/parser/test_preset_sbd.py @@ -4,7 +4,7 @@ from spacy.attrs import NORM from spacy.gold import GoldParse from spacy.vocab import Vocab -from spacy.ml.models.defaults import default_parser +from spacy.pipeline.defaults import default_parser from spacy.tokens import Doc from spacy.pipeline import DependencyParser diff --git a/spacy/tests/pipeline/test_textcat.py b/spacy/tests/pipeline/test_textcat.py index b091ec0de..725a4fd69 100644 --- a/spacy/tests/pipeline/test_textcat.py +++ b/spacy/tests/pipeline/test_textcat.py @@ -11,7 +11,7 @@ from spacy.gold import GoldParse from spacy.util import fix_random_seed from ..util import make_tempdir -from ...ml.models.defaults import default_tok2vec +from spacy.pipeline.defaults import default_tok2vec TRAIN_DATA = [ ("I'm so happy.", {"cats": {"POSITIVE": 1.0, "NEGATIVE": 0.0}}), diff --git a/spacy/tests/regression/test_issue1501-2000.py b/spacy/tests/regression/test_issue1501-2000.py index 5f5f0c9eb..5a76697bc 100644 --- a/spacy/tests/regression/test_issue1501-2000.py +++ b/spacy/tests/regression/test_issue1501-2000.py @@ -10,7 +10,7 @@ from spacy.lang.lex_attrs import is_stop from spacy.vectors import Vectors from spacy.vocab import Vocab from spacy.language import Language -from spacy.ml.models.defaults import default_ner, default_tagger +from spacy.pipeline.defaults import default_ner, default_tagger from spacy.tokens import Doc, Span, Token from spacy.pipeline import Tagger, EntityRecognizer from spacy.attrs import HEAD, DEP diff --git a/spacy/tests/regression/test_issue3001-3500.py b/spacy/tests/regression/test_issue3001-3500.py index 06ba6c4ac..240163d6e 100644 --- a/spacy/tests/regression/test_issue3001-3500.py +++ b/spacy/tests/regression/test_issue3001-3500.py @@ -1,7 +1,7 @@ import pytest from spacy.lang.en import English from spacy.lang.de import German -from spacy.ml.models.defaults import default_ner +from spacy.pipeline.defaults import default_ner from spacy.pipeline import EntityRuler, EntityRecognizer from spacy.matcher import Matcher, PhraseMatcher from spacy.tokens import Doc diff --git a/spacy/tests/regression/test_issue3830.py b/spacy/tests/regression/test_issue3830.py index 9752f70df..3d8e80847 100644 --- a/spacy/tests/regression/test_issue3830.py +++ b/spacy/tests/regression/test_issue3830.py @@ -1,7 +1,7 @@ from spacy.pipeline.pipes import DependencyParser from spacy.vocab import Vocab -from spacy.ml.models.defaults import default_parser +from spacy.pipeline.defaults import default_parser def test_issue3830_no_subtok(): diff --git a/spacy/tests/regression/test_issue4042.py b/spacy/tests/regression/test_issue4042.py index 75a1c23b7..30081543b 100644 --- a/spacy/tests/regression/test_issue4042.py +++ b/spacy/tests/regression/test_issue4042.py @@ -3,7 +3,7 @@ from spacy.pipeline import EntityRecognizer, EntityRuler from spacy.lang.en import English from spacy.tokens import Span from spacy.util import ensure_path -from spacy.ml.models.defaults import default_ner +from spacy.pipeline.defaults import default_ner from ..util import make_tempdir diff --git a/spacy/tests/regression/test_issue4313.py b/spacy/tests/regression/test_issue4313.py index 30688601f..ba4d2deab 100644 --- a/spacy/tests/regression/test_issue4313.py +++ b/spacy/tests/regression/test_issue4313.py @@ -1,6 +1,6 @@ from collections import defaultdict -from spacy.ml.models.defaults import default_ner +from spacy.pipeline.defaults import default_ner from spacy.pipeline import EntityRecognizer from spacy.lang.en import English diff --git a/spacy/tests/serialize/test_serialize_pipeline.py b/spacy/tests/serialize/test_serialize_pipeline.py index 475181c7b..4fc277c4f 100644 --- a/spacy/tests/serialize/test_serialize_pipeline.py +++ b/spacy/tests/serialize/test_serialize_pipeline.py @@ -1,8 +1,8 @@ import pytest from spacy.pipeline import Tagger, DependencyParser, EntityRecognizer from spacy.pipeline import Tensorizer, TextCategorizer, SentenceRecognizer -from spacy.ml.models.defaults import default_parser, default_tensorizer, default_tagger -from spacy.ml.models.defaults import default_textcat, default_senter +from spacy.pipeline.defaults import default_parser, default_tensorizer, default_tagger +from spacy.pipeline.defaults import default_textcat, default_senter from ..util import make_tempdir