deepl

Deepl API: Translate single word with context from whole sentence


I want to translate single words out of a whole sentence using the DeepL API.

For example, the sentence might be: "How may I help you?"

If I now want to translate the word "help", DeepL might treat it as a noun (the help) or as verb (to help), both resulting in different outcomes in, for example, German language.

Is there a possibility to send the whole sentence as context to help DeepL disambiguate the word?

I tried to mark the word that I want to isolate. For example:

"How may I "help" you?"

But this seems to destroy the result or be ignored by DeepL.


Solution

  • Found out the answer. The docs describe here how to use context.

    Attention: As stated by the docs, this feature is still in alpha as of now:

    "The context parameter is an alpha feature as defined in section 3.1.5 of our terms and conditions. This means it could be changed or deprecated by DeepL at any point and without advance notice."