Skip to content

Commit

Permalink
TT-1065: Return None on langdetect error
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrebeauguitte committed Sep 12, 2023
1 parent c94ed95 commit b7706e5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions metadata_extract/meteor.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ def __default_detect(text: str) -> Optional[str]:
lang = langdetect.detect(text)
except LangDetectException:
return None
if not isinstance(lang, str):
raise RuntimeError(f"Unexpected type for detected language: {type(lang)}")
if lang == "unknown":
if not isinstance(lang, str) or lang == "unknown":
return None
return lang

Expand Down

0 comments on commit b7706e5

Please sign in to comment.