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