Fix mypy error in edittree lemmatizer (#11612)

* cleanup imports

* try limiting Thinc to previous release

* remove Model specification

* fix code and revert Thinc constraint
This commit is contained in:
Sofie Van Landeghem 2022-10-11 14:15:22 +02:00 committed by GitHub
parent 8cd77dd54c
commit ef74f8f5e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,7 +1,6 @@
from typing import cast, Any, Callable, Dict, Iterable, List, Optional
from typing import Sequence, Tuple, Union
from typing import Tuple
from collections import Counter
from copy import deepcopy
from itertools import islice
import numpy as np
@ -150,7 +149,7 @@ class EditTreeLemmatizer(TrainablePipe):
# Handle cases where there are no tokens in any docs.
n_labels = len(self.cfg["labels"])
guesses: List[Ints2d] = [
self.model.ops.alloc((0, n_labels), dtype="i") for doc in docs
self.model.ops.alloc2i(0, n_labels, dtype="i") for _ in docs
]
assert len(guesses) == n_docs
return guesses