From 3680c51b8fe395f16bd89dcdabdff71868380a59 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 4 Jun 2017 15:52:42 -0500 Subject: [PATCH] Avoid clobbering preset POS tags --- spacy/pipeline.pyx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spacy/pipeline.pyx b/spacy/pipeline.pyx index a838b3412..93955848f 100644 --- a/spacy/pipeline.pyx +++ b/spacy/pipeline.pyx @@ -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):