mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-25 17:36:30 +03:00
Fix tagger when docs are empty
This commit is contained in:
parent
526be40823
commit
3786942ff1
|
@ -449,7 +449,8 @@ class Tagger(Pipe):
|
|||
def predict(self, docs):
|
||||
if not any(len(doc) for doc in docs):
|
||||
# Handle case where there are no tokens in any docs.
|
||||
return [self.model.ops.allocate((0, self.model.nO)) for doc in docs]
|
||||
n_labels = len(self.labels)
|
||||
return [self.model.ops.allocate((0, n_labels)) for doc in docs]
|
||||
tokvecs = self.model.tok2vec(docs)
|
||||
scores = self.model.softmax(tokvecs)
|
||||
guesses = []
|
||||
|
|
Loading…
Reference in New Issue
Block a user