* Don't assign 0-valued tags in Doc.from_array

This commit is contained in:
Matthew Honnibal 2016-05-02 16:07:50 +02:00
parent c1c11a8ae0
commit 29a114e645
1 changed files with 3 additions and 2 deletions

View File

@ -387,8 +387,9 @@ cdef class Doc:
tokens[i + values[i]].r_kids += 1 tokens[i + values[i]].r_kids += 1
elif attr_id == TAG: elif attr_id == TAG:
for i in range(length): for i in range(length):
self.vocab.morphology.assign_tag(&tokens[i], if values[i] != 0:
self.vocab.morphology.reverse_index[values[i]]) self.vocab.morphology.assign_tag(&tokens[i],
self.vocab.morphology.reverse_index[values[i]])
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]