Update kitchen_counter/conversion/translation/translation_function.py
This commit is contained in:
parent
1da3782a91
commit
174bc7008a
|
@ -461,11 +461,15 @@ def translate_comparison2(text, source_lang, target_lang, script_data=None, subs
|
||||||
|
|
||||||
if is_dialogue:
|
if is_dialogue:
|
||||||
tokenizers_valid_langs = ("malayalam", "french", "italian", "german", "spanish", "swedish", "finnish", "danish", "english", "slovene", "norwegian", "dutch", "portuguese", "czech", "russian", "polish","turkish", "estonian", "greek")
|
tokenizers_valid_langs = ("malayalam", "french", "italian", "german", "spanish", "swedish", "finnish", "danish", "english", "slovene", "norwegian", "dutch", "portuguese", "czech", "russian", "polish","turkish", "estonian", "greek")
|
||||||
|
try:
|
||||||
if code_2_language[source_lang].lower() in tokenizers_valid_langs:
|
if code_2_language[source_lang].lower() in tokenizers_valid_langs:
|
||||||
sentences = sent_tokenize(text, language=(code_2_language[source_lang]).lower())
|
sentences = sent_tokenize(text, language=(code_2_language[source_lang]).lower())
|
||||||
else:
|
else:
|
||||||
sentences = text.split(".")
|
sentences = text.split(".")
|
||||||
|
except Exception as e:
|
||||||
|
print("Error was : ", e)
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
# List of translated sentences
|
# List of translated sentences
|
||||||
translated_text = []
|
translated_text = []
|
||||||
|
|
Loading…
Reference in New Issue