Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script Fails When Translating from Khmer to English (Not using different provider) #102

Open
mcnamara-charles opened this issue Dec 4, 2022 · 0 comments

Comments

@mcnamara-charles
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant