* Hastily add method to apply tags from a list of strings, instead of predicting the tags.

This commit is contained in:
Matthew Honnibal 2015-02-23 15:40:17 -05:00
parent 6102360111
commit caf046b220
1 changed files with 10 additions and 0 deletions

View File

@ -284,6 +284,16 @@ cdef class EnPosTagger:
tokens.is_tagged = True
tokens._py_tokens = [None] * tokens.length
def tag_from_strings(self, Tokens tokens, object tag_strs):
cdef int i
for i in range(tokens.length):
tokens.data[i].tag = self.tag_names.index(tag_strs[i])
self.set_morph(i, tokens.data)
# TODO: Clean this up.
tokens._tag_strings = tuple(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
cdef int loss