feat: add baidu translate api

This commit is contained in:
lanvent
2023-04-23 03:51:09 +08:00
parent 8bb36e0eb6
commit cae12eb187
7 changed files with 81 additions and 5 deletions

12
translate/translator.py Normal file
View File

@@ -0,0 +1,12 @@
"""
Voice service abstract class
"""
class Translator(object):
# please use https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes to specify language
def translate(self, query: str, from_lang: str = "", to_lang: str = "en") -> str:
"""
Translate text from one language to another
"""
raise NotImplementedError