breaking change, removes the mess that the translation utilities were, returned data is different and many methods are missing
apertium essentially only worked for spanish, google is not privacy respecting
libretranslate is FOSS, can be self hosted, provides a demo key, supports many languages, and is accurate, this is now the default and only engine
closes #2
Usage
from ovos_utils.lang import detect_lang
# detecting language
detect_lang("olá eu chamo-me joaquim") # "pt"
detect_lang("olá eu chamo-me joaquim", return_dict=True)
# {'confidence': 0.9999939001351439, 'language': 'pt'}
detect_lang("hello world") # "en"
detect_lang("This piece of text is in English. Този текст е на Български.", return_dict=True)
# {'confidence': 0.28571342657428966, 'language': 'en'}
from ovos_utils.lang import translate_text
## source lang will be auto detected using utils above
## default target language is english
translate_text("olá eu chamo-me joaquim") # "Hello I call myself joaquim"
## you should specify source lang whenever possible to save 1 api call
translate_text("olá eu chamo-me joaquim", source_lang="pt", lang="es") # "Hola, me llamo Joaquim"
breaking change, removes the mess that the translation utilities were, returned data is different and many methods are missing
apertium essentially only worked for spanish, google is not privacy respecting
libretranslate is FOSS, can be self hosted, provides a demo key, supports many languages, and is accurate, this is now the default and only engine
closes #2
Usage