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

The Google translation results returned by this lib are different from results returned by web translation. #283

Open
Waste2Time opened this issue Feb 7, 2025 · 4 comments

Comments

@Waste2Time
Copy link

deep_translator_test.py

from deep_translator import GoogleTranslator

# Use any translator you like, in this example GoogleTranslator
translated = GoogleTranslator(source='ja', target='en').translate("僕は三十七歳で、そのときボーイング747のシートに座っていた。その巨大な飛行機はぶ厚い雨雲をくぐり抜けて降下し、ハンブルク空港に着陸しようとしているところだった。十一月の冷ややかな雨が大地を暗く染め、雨合羽を着た整備工たちや、のっぺりとした空港ビルの上に立った旗や、BMWの広告板やそんな何もかもをフランドル派の陰うつな絵の背景のように見せていた。やれやれ、またドイツか、と僕は思った。")  # output -> Weiter so, du bist großartig
print(translated)

and it returns

I was 37 years old and was sitting in the seat of a Boeing 747. The giant plane went through thick rain clouds and was about to land at Hamburg Airport. The cold November rains dyed the earth darkly, with the mechanics wearing raincoats, flags standing on flat-top airport buildings, BMW billboards and everything else shining pictures of the Flemish sect. It looked like the background. Oh, I thought, Germany again.

web returns

I was 37 years old and sat in a Boeing 747. The giant plane was descending through thick rainclouds and landing at Hamburg airport. The cold November rain darkened the earth, making the coat-clad mechanics, the flags atop the plain airport building, the BMW billboard, and everything else look like the backdrop of a gloomy Flemish painting. Oh dear, Germany again, I thought.

It seems that Google is changing these undocumentary APIs, the happened to another API a few days ago. The API used by this lib also happened today. Moreover, this API seems to be unstable at the moment, with intermittent 500 errors. Has anyone else had this problem?

@Waste2Time Waste2Time changed the title The translation results returned by this lib are different from results returned by web translation. The Google translation results returned by this lib are different from results returned by web translation. Feb 7, 2025
@ILG2021
Copy link

ILG2021 commented Feb 7, 2025

It happened yesterday. The request rate is more limit and quality is reduce.

@Neko-Kuroi
Copy link

#286

same ?

https://imgur.com/a/xfZ3Ahr

maybe "500 error" has gone...right?

-> patched by xpz3
#289 (comment)

@Neko-Kuroi
Copy link

Neko-Kuroi commented Feb 16, 2025

Test text

"I was 37 then, strapped in my seat as the huge 747 plunged through dense cloud cover on approach to Hamburg airport. Cold November rains drenched the earth, lending everything the gloomy air of a Flemish landscape: the ground crew in waterproofs, a flag atop a squat airport building, a BMW billboard. So - Germany again."

by Jay Rubin

https://imgur.com/a/WTgmHXb

google official web translate result:

当時私は37歳で、巨大な747がハンブルク空港への進入で厚い雲を突き抜けて急降下するのを座席で見ていた。11月の冷たい雨が地面を濡らし、防水服を着た地上係員、ずんぐりとした空港ビルの頂上の旗、BMWの看板など、すべてがフランドル地方の風景の陰鬱な雰囲気を醸し出していた。そう、またドイツだ。

deep-translator:

from deep_translator import GoogleTranslator
text = "I was 37 then, strapped in my seat as the huge 747 plunged through dense cloud cover on approach to Hamburg airport. Cold November rains drenched the earth, lending everything the gloomy air of a Flemish landscape: the ground crew in waterproofs, a flag atop a squat airport building, a BMW billboard. So - Germany again."
gt = GoogleTranslator(source="auto", target="ja")

translated_ = gt.translate(text=text)
print(translated_)

result:

私は37歳でしたが、ハンブルク空港へのアプローチで巨大な747が密集した雲の覆いを突き抜けたので、私は席に縛り付けられました。寒い11月の雨が地球をびしょぬれにし、フランドルの風景の悲観的な空気をすべて貸し出しました。防水の地上乗組員、スクワット空港の建物の上の旗、BMWの看板。だから - ドイツも再び。

google unofficial API result:

#pyscript
source_lang = "auto"
target_lang = "ja"

q_texts = "&q=" + quote(text)
gt_url = f"https://translate.googleapis.com/translate_a/single?client=gtx&sl={source_lang}&tl={target_lang}&dt=t{q_texts}"
response = await fetch(gt_url)
data = await response.json()
translations = data[0]

result:

私は37歳でしたが、ハンブルク空港へのアプローチで巨大な747が密集した雲の覆いを突き抜けたので、私は席に縛り付けられました。

寒い11月の雨が地球をびしょぬれにし、フランドルの風景の悲観的な空気をすべて貸し出しました。防水の地上乗組員、スクワット空港の建物の上の旗、BMWの看板。

だから - ドイツも再び。

This seems to be more a case of the API endpoint different than a literary interpretation.

@xpz3
Copy link

xpz3 commented Feb 18, 2025

deep_translator_test.py

from deep_translator import GoogleTranslator

# Use any translator you like, in this example GoogleTranslator
translated = GoogleTranslator(source='ja', target='en').translate("僕は三十七歳で、そのときボーイング747のシートに座っていた。その巨大な飛行機はぶ厚い雨雲をくぐり抜けて降下し、ハンブルク空港に着陸しようとしているところだった。十一月の冷ややかな雨が大地を暗く染め、雨合羽を着た整備工たちや、のっぺりとした空港ビルの上に立った旗や、BMWの広告板やそんな何もかもをフランドル派の陰うつな絵の背景のように見せていた。やれやれ、またドイツか、と僕は思った。")  # output -> Weiter so, du bist großartig
print(translated)

and it returns

I was 37 years old and was sitting in the seat of a Boeing 747. The giant plane went through thick rain clouds and was about to land at Hamburg Airport. The cold November rains dyed the earth darkly, with the mechanics wearing raincoats, flags standing on flat-top airport buildings, BMW billboards and everything else shining pictures of the Flemish sect. It looked like the background. Oh, I thought, Germany again.

web returns

I was 37 years old and sat in a Boeing 747. The giant plane was descending through thick rainclouds and landing at Hamburg airport. The cold November rain darkened the earth, making the coat-clad mechanics, the flags atop the plain airport building, the BMW billboard, and everything else look like the backdrop of a gloomy Flemish painting. Oh dear, Germany again, I thought.

It seems that Google is changing these undocumentary APIs, the happened to another API a few days ago. The API used by this lib also happened today. Moreover, this API seems to be unstable at the moment, with intermittent 500 errors. Has anyone else had this problem?

see this #289 (comment)

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

4 participants