Skip to content

Commit

Permalink
Truncate text in language detection logging
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcombessie committed Sep 30, 2020
1 parent b730ad2 commit 28ef5a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions python-lib/language_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 28ef5a1

Please sign in to comment.