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 API doesn't translate English to Spanish when there's a small typo; it just returns the English text. However, it works for English to French. #50

Closed
JavaPr288 opened this issue Jun 25, 2024 · 3 comments

Comments

@JavaPr288
Copy link

JavaPr288 commented Jun 25, 2024

Describe the bug
I try to translate Hello darkness my old friend Ive come to talk with you again to Spanish gives Hello darkness my old friend Ive come to talk with you again.
However with French and Italian it works correctly

To Reproduce
Steps to reproduce the behavior:
Use the API To Translate English to Spanish
Hello darkness my old friend Ive come to talk with you again to Spanish gives Hello darkness my old friend Ive come to talk with you again.

Expected behavior
It should translate to Spanish

Timestamp: 2024-06-25 22:15:42

Error Spanish
image

Correct Spanish No Typo
image

Working French
image

@JanEbbing
Copy link
Member

I cant reproduce this (using our python CLI to hit the API):

$ poetry run python -m deepl text --to "ES" "Hello darkness my old friend Ive come to talk with you again"

Hola oscuridad mi viejo amigo he venido a hablar con usted otra vez

@JavaPr288
Copy link
Author

Hi,
I realized I was using a context prompt which was correct the problem when I removed the prompt it got resolved.

Thanks for your help!

async function translateText(text, targetLang) {
  try {
    const systemPrompt = "You are a skilled translator. Correct any typos in the English while translating it into Spanish, ensuring the translation is accurate and natural."
    const result = await translator.translateText(text, null, targetLang,{context:systemPrompt});
    console.log("Translated text:", result.text);
  } catch (error) {
    console.error("Error during translation:", error.message);
  }
}

// Example usage

console.log(translateText("Hello darkness my old friend Ive come to talk with you again", "ES"));

@JavaPr288
Copy link
Author

Will close the issue!
Removing the context prompt solved the issue.
Thanks again for your help!

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

2 participants