translate-python
translate-python copied to clipboard
Script Fails When Translating from Khmer to English (Not using different provider)
When attempting to translate some example text from Khmer to english, the translator fails. It's able to translate English into Khmer I fail to see why it wouldn't be able to do both. Here's the test code that failed
translator= Translator(from_lang="Khmer", to_lang="English")
a_translated = translator.translate("ខ្ញខ្ញុំស្រឡាញ់មាន់")
print(a_translated)
and here's the ensuing error
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\translate\translate.py", line 45, in <genexpr>
return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\translate\providers\mymemory_translated.py", line 49, in get_translation
next_best_match = next(match for match in matches)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "hidden-for-patent-reasons", line 42, in <module>
a_translated = translator.translate("ខ្ញខ្ញុំស្រឡាញ់មាន់")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\user\AppData\Local\Programs\Python\Python311\Lib\site-packages\translate\translate.py", line 45, in translate
return ' '.join(self.provider.get_translation(text_wraped) for text_wraped in text_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: generator raised StopIteration