Hi Team,
I am trying to use Adaptive Translation, the issue is that is ignoring the sentence examples or the provided TMX/TSV. Or even creating a sentence repository. To point out the issue:
I have this eng sentence to translate from en-es:
Please click the button to sign in to your account.
NMT translation is:
Haz clic en el botón para iniciar sesión en tu cuenta. (Notice the Haz clic)
Using examples as:
Please click the button to save your file. -> Pulse el botón para guardar su archivo.
Please click the link to reset your password. -> Pulse el enlace para restablecer su contraseña.
Please click the button to sign in to your new account. -> Pulse en el botón para iniciar sesión en tu nueva cuenta
I get:
Por favor, haga clic en el botón para iniciar sesión en su cuenta.
Notice is adding Por favor (Please) in spanish, that is not in any of my examples.
Notice is not using Pulse instead of Haga clic as all the examples show.
I have seen a similar post, GoogleCloudTranslationAPI(AdaptiveMtTranslateRequest): not giving results based on dataset sentences
How should I deal this? is a defect? Has anyone be able to make this work?
Thanks
Miguel
This is the request!
request = {
"parent": f"projects/{project_id}/locations/us-central1",
"content": ["Please click the button to sign in to your account."],
"reference_sentence_config": {
"source_language_code": "en",
"target_language_code": "es",
"reference_sentence_pair_lists": [
{
"reference_sentence_pairs": [
{
"source_sentence": "Please click the button to save your file.",
"target_sentence": "Pulse el botón para guardar su archivo."
},
{
"source_sentence": "Please click the link to reset your password.",
"target_sentence": "Pulse el enlace para restablecer su contraseña."
},
{
"source_sentence": "Please click the button to sign in to your new account.",
"target_sentence": "Pulse en el botón para iniciar sesión en tu nueva cuenta."
}
]
}
]
}
}
# 4. Execute the API Call
try:
print("Sending request to Google Cloud Adaptive Translation...")
response = client.adaptive_mt_translate(request=request)
# 5. Output Results
for translation in response.translations:
print("\n--- Translation Success ---")
print(f"Translated Text: {translation.translated_text}")
except Exception as e:
print(f"\nAn error occurred: {e}")