Move files

This commit is contained in:
Andras Schmelczer 2022-06-25 14:01:14 +02:00
parent cf0ac4b161
commit 0bf865ce2a
233 changed files with 117 additions and 2394 deletions

View file

@ -0,0 +1,16 @@
from typing import Optional
from langcodes import Language
from langdetect import LangDetectException, detect
def predict_language(text: Optional[str]) -> str:
if not text:
return Language.make().to_tag()
try:
language_code = detect(text)
except LangDetectException:
return Language.make().to_tag()
return Language.get(language_code).to_tag()