mirror of
https://github.com/explosion/spaCy.git
synced 2025-07-12 17:22:25 +03:00
* 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.is_tagged = True
|
||||||
tokens._py_tokens = [None] * tokens.length
|
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):
|
def train(self, Tokens tokens, object gold_tag_strs):
|
||||||
cdef int i
|
cdef int i
|
||||||
cdef int loss
|
cdef int loss
|
||||||
|
|
Loading…
Reference in New Issue
Block a user