Why is the Chinese content "你好啊" translated into "I am Taiwanese"
wuhuanyan opened this issue · 0 comments
wuhuanyan commented
from translate import Translator
translator = Translator(from_lang="zh", to_lang="en")
translation = translator.translate("这是一支笔")
print(translation)
translation = translator.translate("你好啊")
print(translation)
translation = translator.translate("番茄")
print(translation)
translation = translator.translate("番茄能种植吗")
print(translation)
out:
This is a pen
I am Taiwanese
Tomato
Traceback (most recent call last):
File "D:\Anaconda3\envs\douyin\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 "D:\Anaconda3\envs\douyin\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 "D:/Projects/douyin/test.py", line 13, in <module>
translation = translator.translate("番茄能种植吗")
File "D:\Anaconda3\envs\douyin\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