hyperboria/nexus/nlptools/language_detect.py
the-superpirate 9580401bc9 - Instrumentize images with tcmalloc
-  Updated tantipy version

GitOrigin-RevId: 11e96ee1b3d5ffa67c8caf87be9e41e3a297ed70
2021-01-07 14:04:54 +03:00

8 lines
175 B
Python

import cld3
def detect_language(text: str) -> str:
prediction = cld3.get_language(text)
if prediction and prediction.is_reliable:
return prediction.language