mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Make pipeline work on empty docs
This commit is contained in:
parent
d0f9f13543
commit
01ace9734d
|
@ -482,7 +482,7 @@ class Tagger(Pipe):
|
|||
if lemma != 0 and lemma != doc.c[j].lex.orth:
|
||||
doc.c[j].lemma = lemma
|
||||
idx += 1
|
||||
if tensors is not None:
|
||||
if tensors is not None and len(tensors):
|
||||
if isinstance(doc.tensor, numpy.ndarray) \
|
||||
and not isinstance(tensors[i], numpy.ndarray):
|
||||
doc.extend_tensor(tensors[i].get())
|
||||
|
|
|
@ -217,6 +217,8 @@ cdef class Parser:
|
|||
def predict(self, docs, beam_width=1, beam_density=0.0, drop=0.):
|
||||
if isinstance(docs, Doc):
|
||||
docs = [docs]
|
||||
if not any(len(doc) for doc in docs):
|
||||
return self.moves.init_batch(docs)
|
||||
if beam_width < 2:
|
||||
return self.greedy_parse(docs, drop=drop)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user