mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +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.from_array(self.attrs, tokens) # type: ignore
|
||||
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])
|
||||
else:
|
||||
doc.spans.clear()
|
||||
|
|
Loading…
Reference in New Issue
Block a user