From 28ef5a11f329f3390ce69a670f378b25398e2a54 Mon Sep 17 00:00:00 2001 From: alexcombessie Date: Wed, 30 Sep 2020 12:12:53 +0200 Subject: [PATCH] Truncate text in language detection logging --- python-lib/language_detector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python-lib/language_detector.py b/python-lib/language_detector.py index 35171b7..a0eea67 100644 --- a/python-lib/language_detector.py +++ b/python-lib/language_detector.py @@ -14,7 +14,7 @@ LANGUAGE_REMAPPING_PYCLD3_LANGID, ) -from plugin_io_utils import generate_unique +from plugin_io_utils import generate_unique, truncate_text_list class LanguageDetector: @@ -66,7 +66,7 @@ def _cld3_detection(self, doc: AnyStr) -> (AnyStr, float): def _detection_filter(self, doc: AnyStr, lang_id: AnyStr, lang_probability: float) -> (AnyStr, float): if lang_probability < self.minimum_score or lang_id not in self.language_scope: - warning_msg = "Problem encountered for document: '{}'.\n".format(doc) + warning_msg = "Problem encountered for document: '{}'.\n".format(truncate_text_list([doc])[0]) if lang_id not in self.language_scope: warning_msg += "Detected language: '{}' not within language scope: {}.\n".format( lang_id, self.language_scope