* Clear buffered python tokens when modifying the Tokens object. Need to clean this up, and modify via a method on Tokens.

This commit is contained in:
Matthew Honnibal 2015-02-09 03:56:51 -05:00
parent be5536d239
commit 5c3513583d
2 changed files with 5 additions and 1 deletions

View File

@ -274,9 +274,11 @@ cdef class EnPosTagger:
scores = self.model.score(context)
tokens.data[i].tag = arg_max(scores, self.model.n_classes)
self.set_morph(i, tokens.data)
# TODO: Clean this up.
tokens._tag_strings = tuple(self.tag_names)
assert tokens._tag_strings, self.tag_names
tokens.is_tagged = True
tokens._py_tokens = [None] * tokens.length
def train(self, Tokens tokens, object gold_tag_strs):
cdef int i

View File

@ -87,6 +87,8 @@ cdef class GreedyParser:
dep_strings[id_] = label
tokens._dep_strings = tuple(dep_strings)
tokens.is_parsed = True
# TODO: Clean this up.
tokens._py_tokens = [None] * tokens.length
return 0
def train_sent(self, Tokens tokens, list gold_heads, list gold_labels,