Fix clobber of doc.is_tagged in doc.from_array()
If doc.from_array() was called with say, only entity information, this
would cause doc.is_tagged to be set to False, even if tags were set.
This caused tags to be dropped from serialisation. The same was true for
doc.is_parsed.
Closes
@@ -708,8 +708,8 @@ cdef class Doc:
if array[i, col] != 0:
self.vocab.morphology.assign_tag(&tokens[i], array[i, col])
# set flags
- self.is_parsed = bool(HEAD in attrs or DEP in attrs)
- self.is_tagged = bool(TAG in attrs or POS in attrs)
+ self.is_parsed = bool(self.is_parsed or HEAD in attrs or DEP in attrs)
+ self.is_tagged = bool(self.is_tagged or TAG in attrs or POS in attrs)
# if document is parsed, set children
if self.is_parsed:
set_children_from_heads(self.c, self.length)
