mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
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 #3012.
This commit is contained in:
parent
bf20252ae0
commit
d8d0ce081b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user