Add set_morphology cfg option for Tagger
@@ -357,6 +357,14 @@ class Tagger(Pipe):
self.cfg = OrderedDict(sorted(cfg.items()))
self.cfg.setdefault("cnn_maxout_pieces", 2)
+ @property
+ def set_morphology(self):
+ return self.cfg.get("set_morphology", True)
+
+ @property.setter
+ def set_morphology(self, value):
+ return self.cfg["set_morphology"] = True
+
@property
def labels(self):
return tuple(self.vocab.morphology.tag_names)
@@ -410,7 +418,8 @@ class Tagger(Pipe):
doc_tag_ids = doc_tag_ids.get()
for j, tag_id in enumerate(doc_tag_ids):
# Don't clobber preset POS tags
- if doc.c[j].tag == 0 and doc.c[j].pos == 0:
+ if doc.c[j].tag == 0:
+ if doc.c[j].pos == 0 and self.set_morphology:
# Don't clobber preset lemmas
lemma = doc.c[j].lemma
vocab.morphology.assign_tag_id(&doc.c[j], tag_id)
