From 7c6854d8d4002d6a7178dcab4e10ac5bad2ef2a1 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Sun, 9 Aug 2020 22:28:29 +0200 Subject: [PATCH] Fix missing imports --- spacy/pipeline/tagger.pyx | 3 ++- spacy/pipeline/textcat.py | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) 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