File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ def language_detector(text: str) -> float:
4343 return ftlangdetect .detect (text .lower ())["score" ]
4444 assert isinstance (language_detector ("This is a test" ), float )
4545except Exception as err :
46- red (f"Couldn't import optional package 'ftlangdetect', trying to import langdetect (but it's much slower): '{ err } '" )
46+ if is_verbose :
47+ red (f"Couldn't import optional package 'ftlangdetect', trying to import langdetect (but it's much slower): '{ err } '" )
4748 if "ftlangdetect" in sys .modules :
4849 del sys .modules ["ftlangdetect" ]
4950
@@ -55,7 +56,8 @@ def language_detector(text: str) -> float:
5556 return langdetect .detect_langs (text .lower ())[0 ].prob
5657 assert isinstance (language_detector ("This is a test" ), float )
5758 except Exception as err :
58- red (f"Couldn't import optional package 'langdetect': '{ err } '" )
59+ if is_verbose :
60+ red (f"Couldn't import optional package 'langdetect' either: '{ err } '" )
5961 @optional_typecheck
6062 def language_detector (text : str ) -> None :
6163 return None
You can’t perform that action at this time.
0 commit comments