mirror of https://github.com/explosion/spaCy.git
Fix bug when docs are empty
This commit is contained in:
parent
df3668da12
commit
e0860bcfb3
|
@ -449,7 +449,7 @@ class Tagger(Pipe):
|
||||||
def predict(self, docs):
|
def predict(self, docs):
|
||||||
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.
|
||||||
return [self.model.ops.allocate((0, self.model.nO) for doc in docs]
|
return [self.model.ops.allocate((0, self.model.nO)) for doc in docs]
|
||||||
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