From 13b544b1d2eb29617000dbbdd38d0405226edd33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20B=C3=BCttner?= Date: Mon, 23 Oct 2023 15:24:18 +0200 Subject: [PATCH] Move global flags to the start of regular expressions (fix for issue #348) --- calamari_ocr/ocr/text_processing/text_regularizer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/calamari_ocr/ocr/text_processing/text_regularizer.py b/calamari_ocr/ocr/text_processing/text_regularizer.py index ea7f4e8b..7c623e70 100644 --- a/calamari_ocr/ocr/text_processing/text_regularizer.py +++ b/calamari_ocr/ocr/text_processing/text_regularizer.py @@ -72,7 +72,7 @@ def default_text_regularizer_params(params=TextProcessorParams(), groups=["simpl def replacement(old, new, regex=False): r = params.replacements.add() - r.old = old + r.old = "(?u)" + old[:-4] if regex and old.endswith("(?u)") else old r.new = new r.regex = regex