* Set is_parsed and is_tagged attrs when loading annotations into Doc, re Issue #152

This commit is contained in:
Matthew Honnibal 2015-10-28 10:43:22 +11:00
parent 1c0356e4c2
commit 52fc338001

View File

@ -388,9 +388,13 @@ cdef class Doc:
tokens[i + values[i]].l_kids += 1 tokens[i + values[i]].l_kids += 1
elif values[i] < 0: elif values[i] < 0:
tokens[i + values[i]].r_kids += 1 tokens[i + values[i]].r_kids += 1
if not self.is_parsed and tokens[i].head != 0:
self.is_parsed = True
elif attr_id == TAG: elif attr_id == TAG:
for i in range(length): for i in range(length):
tokens[i].tag = values[i] tokens[i].tag = values[i]
if not self.is_tagged and tokens[i].tag != 0:
self.is_tagged = True
elif attr_id == POS: elif attr_id == POS:
for i in range(length): for i in range(length):
tokens[i].pos = <univ_pos_t>values[i] tokens[i].pos = <univ_pos_t>values[i]