Are alternative translations supported?

Does the API support providing multiple alternative translations as part of the response?

For example, for the query:
{ “q”: “Hello!”, “source”: “en”, “target”: “ru” }

I would get:
[‘Hi!’, ‘Hey!’, ‘Greetings!’]

Currently not; that’s an interesting feature though. I know we have the ability to return more than just one translation using ctranslate2, but these changes might have to be added to argos-translate first, then to LibreTranslate.

@pierotofy I have been using libre translate locally for a few hours yesterday and I very impressed that you can get that much out of it for free, but when comparing to paid APIs, that’s one feature that is missing and it’s very practical. I sometimes translate a word that doesn’t make any sense, but reading some extra options, some alternative meanings, that makes a huge difference. Do you recommend I should open a feature request in argos translate?

Either there or in LibreTranslate; if you can contribute in any other way (contribute a code pull request, or offer to sponsor the feature) it could speed the implementation too.

1 Like

Argos Translate already supports requesting multiple translation hypotheses (provided by CTranslate2 beam search) but this functionality isn’t currently exposed in LibreTranslate.

argostranslate.translate.ITranslation.hypotheses(self, input_text: str, num_hypotheses: int = 4) -> list[Hypothesis]

Ohh, interesting; I didn’t know this was already available in argos.

1 Like

A very necessary function. When you translate a big text, it doesn’t make sense.
When you translate a word or phrase, this is a very useful thing.
It’s a popular feature.