diff --git a/spacy/pipeline/tagger.pyx b/spacy/pipeline/tagger.pyx index c5791213f..9be562b61 100644 --- a/spacy/pipeline/tagger.pyx +++ b/spacy/pipeline/tagger.pyx @@ -1,8 +1,9 @@ # cython: infer_types=True, profile=True, binding=True +from typing import List import numpy import srsly - from thinc.api import Model, set_dropout_rate, SequenceCategoricalCrossentropy, Config +from thinc.types import Floats2d import warnings from ..tokens.doc cimport Doc diff --git a/spacy/pipeline/textcat.py b/spacy/pipeline/textcat.py index cb72a5cd1..d632825bd 100644 --- a/spacy/pipeline/textcat.py +++ b/spacy/pipeline/textcat.py @@ -1,5 +1,6 @@ from typing import Iterable, Tuple, Optional, Dict, List, Callable, Iterator, Any from thinc.api import get_array_module, Model, Optimizer, set_dropout_rate, Config +from thinc.types import Floats2d import numpy from .pipe import Pipe @@ -69,7 +70,10 @@ subword_features = true default_score_weights={"cats_score": 1.0}, ) def make_textcat( - nlp: Language, name: str, model: Model[List[Doc], List[Floats2d]], labels: Iterable[str] + nlp: Language, + name: str, + model: Model[List[Doc], List[Floats2d]], + labels: Iterable[str], ) -> "TextCategorizer": """Create a TextCategorizer compoment. The text categorizer predicts categories over a whole document. It can learn one or more labels, and the labels can