From 7cd8c3946ae2b723fcf4b4142db1d98cb76fe712 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 19 Jun 2024 07:31:14 +0000 Subject: [PATCH] conversion changes audit from one particular user --- .../conversion/translation/translation_function.py | 12 ++++++++---- .../conversion/translation/translation_resources.py | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/kitchen_counter/conversion/translation/translation_function.py b/kitchen_counter/conversion/translation/translation_function.py index f853ba2..99801ca 100755 --- a/kitchen_counter/conversion/translation/translation_function.py +++ b/kitchen_counter/conversion/translation/translation_function.py @@ -461,11 +461,15 @@ def translate_comparison2(text, source_lang, target_lang, script_data=None, subs 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") + try: + if code_2_language[source_lang].lower() in tokenizers_valid_langs: + sentences = sent_tokenize(text, language=(code_2_language[source_lang]).lower()) + else: + sentences = text.split(".") + except Exception as e: + print("Error was : ", e) + return text - if code_2_language[source_lang].lower() in tokenizers_valid_langs: - sentences = sent_tokenize(text, language=(code_2_language[source_lang]).lower()) - else: - sentences = text.split(".") # List of translated sentences translated_text = [] diff --git a/kitchen_counter/conversion/translation/translation_resources.py b/kitchen_counter/conversion/translation/translation_resources.py index 2a1ba90..f980a14 100755 --- a/kitchen_counter/conversion/translation/translation_resources.py +++ b/kitchen_counter/conversion/translation/translation_resources.py @@ -194,6 +194,6 @@ def checker(text, src_lang, tar_lang): # end_time = time.time() # print("Time took is ->", end_time - start_time) -print("Prince was Here!!!") -text = "Amazing to see everything alright." -checker(text, 'en', 'el') +# print("Prince was Here!!!") +# text = "Amazing to see everything alright." +# checker(text, 'en', 'el')