mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 10:16:27 +03:00
Maintain support for empty DocBin span groups (#10538)
This commit is contained in:
parent
2ff197603e
commit
31a5d99efa
|
@ -147,7 +147,8 @@ class DocBin:
|
||||||
doc = Doc(vocab, words=tokens[:, orth_col], spaces=spaces) # type: ignore
|
doc = Doc(vocab, words=tokens[:, orth_col], spaces=spaces) # type: ignore
|
||||||
doc = doc.from_array(self.attrs, tokens) # type: ignore
|
doc = doc.from_array(self.attrs, tokens) # type: ignore
|
||||||
doc.cats = self.cats[i]
|
doc.cats = self.cats[i]
|
||||||
if self.span_groups[i] != SpanGroups._EMPTY_BYTES:
|
# backwards-compatibility: may be b'' or serialized empty list
|
||||||
|
if self.span_groups[i] and self.span_groups[i] != SpanGroups._EMPTY_BYTES:
|
||||||
doc.spans.from_bytes(self.span_groups[i])
|
doc.spans.from_bytes(self.span_groups[i])
|
||||||
else:
|
else:
|
||||||
doc.spans.clear()
|
doc.spans.clear()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user