From 2c266647f33235c6682de01411634e50439158a4 Mon Sep 17 00:00:00 2001
From: pat <pat@wifi-secure2-685.sri.ucl.ac.be>
Date: Tue, 24 Oct 2017 09:54:25 +0200
Subject: [PATCH] fixed output mode in the 'tag' procedure

---
 unitex/processor.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/unitex/processor.py b/unitex/processor.py
index 3a5b2df..54d353a 100644
--- a/unitex/processor.py
+++ b/unitex/processor.py
@@ -489,7 +489,11 @@ class UnitexProcessor(object):
         match_mode = kwargs.get("match_mode", UnitexConstants.MATCH_MODE_LONGEST)
         if match_mode not in (UnitexConstants.MATCH_MODE_LONGEST, UnitexConstants.MATCH_MODE_SHORTEST):
             raise UnitexException("Invalid match mode '%s'...")
-        output_mode = UnitexConstants.OUTPUT_MODE_MERGE
+        output_mode = kwargs.get("output_mode", UnitexConstants.OUTPUT_MODE_MERGE)
+        if output_mode not in (UnitexConstants.OUTPUT_MODE_IGNORE,
+                               UnitexConstants.OUTPUT_MODE_MERGE,
+                               UnitexConstants.OUTPUT_MODE_REPLACE):
+            raise UnitexException("Wrong value for the 'output_mode' option. UnitexConstants.OUTPUT_MODE_X required.")
 
         index = self._locate(grammar, match_mode, output_mode)
 
-- 
GitLab