Conversion_Kitchen_Code/kitchen_counter/conversion/translation/vector_transliteration.py

30 lines
870 B
Python
Raw Normal View History

2024-04-27 09:33:09 +00:00
from .translation_variables import get_language_script_code,get_language_script,original_script,get_expansion,get_language_script
from .final_transliteration_only import transliterate
from .detection import language_detector, script_det
def vector_transliteration(dialoge):
language=language_detector(dialoge)
script=get_language_script_code(language)
print("script it",script)
dial_dest_script = script
# for i in range(1):
text = dialoge
trans_text=dialoge
dial_src_lang = language_detector(text)
dial_src_script = script_det(text)
if dial_src_script == "Common":
return trans_text
if dial_src_script == dial_dest_script:
pass
else:
trans_text = transliterate(
dial_dest_script, dial_src_script, dial_src_lang, text
)
return trans_text