mirror of https://github.com/explosion/spaCy.git
* Hastily add method to apply tags from a list of strings, instead of predicting the tags.
This commit is contained in:
parent
6102360111
commit
caf046b220
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue