mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
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:
parent
8cd77dd54c
commit
ef74f8f5e4
|
@ -1,7 +1,6 @@
|
||||||
from typing import cast, Any, Callable, Dict, Iterable, List, Optional
|
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 collections import Counter
|
||||||
from copy import deepcopy
|
|
||||||
from itertools import islice
|
from itertools import islice
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
@ -150,7 +149,7 @@ class EditTreeLemmatizer(TrainablePipe):
|
||||||
# Handle cases where there are no tokens in any docs.
|
# Handle cases where there are no tokens in any docs.
|
||||||
n_labels = len(self.cfg["labels"])
|
n_labels = len(self.cfg["labels"])
|
||||||
guesses: List[Ints2d] = [
|
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
|
assert len(guesses) == n_docs
|
||||||
return guesses
|
return guesses
|
||||||
|
|
Loading…
Reference in New Issue
Block a user