Avoid clobbering preset POS tags

This commit is contained in:
Matthew Honnibal 2017-06-04 15:52:42 -05:00
parent 939e8ed567
commit 3680c51b8f
1 changed files with 3 additions and 1 deletions

View File

@ -233,7 +233,9 @@ class NeuralTagger(object):
for i, doc in enumerate(docs):
doc_tag_ids = batch_tag_ids[i]
for j, tag_id in enumerate(doc_tag_ids):
vocab.morphology.assign_tag_id(&doc.c[j], tag_id)
# Don't clobber preset POS tags
if doc.c[j].tag == 0 and doc.c[j].pos == 0:
vocab.morphology.assign_tag_id(&doc.c[j], tag_id)
idx += 1
def update(self, docs_tokvecs, golds, drop=0., sgd=None, losses=None):