DeepLcom / deepl-api-issues

Issue tracking repository for the DeepL API.
MIT License
0 stars 0 forks source link

API - detected_source_language giving wrong or insuffisant informations #23

Closed Steelwix closed 4 months ago

Steelwix commented 4 months ago

Good morning,

I'm receiving words from a language I don't know in my PHP application(it could be French or English), and I was surprised to see an english word in my french translation table.

It turns out that on this query, Deepl detects that the original language of "saffron" is French :

{
    "text":["saffron"],
    "target_lang": "EN"
}

Returns :

{
    "translations": [
        {
            "detected_source_language": "FR",
            "text": "saffron"
        }
    ]
}

The source_language should be "EN"

I have another conflict with the word "verre" (glass in french), where Deepl detects a source_language = "NL", even though it is also a french word.

Is there a way to refine these searches, considering that I don't necessarily know if my source_language is FR or EN, but for example by excluding languages ​​that I don't want, like NL?

Or is there any way to to ensure that an english word is not detected as french?

Sincerely,

Mael

JanEbbing commented 4 months ago

Hi, we don't have features to customize/help language detection at the moment unfortunately. There was some discussion around this and what the interface could look like in our discord community (you need to be in the community to see the link). In general, source language detection works much better for longer input texts. Are your inputs always single words? Maybe looking up the words in a dictionary is a better way for single-word translation. (though of course many words are valid in multiple languages, which you would need to distinguish somehow; and you would need to be able to handle typos/misspellings).

Steelwix commented 4 months ago

Thanks for your quick response. Yes, sadly I have only single words comming in so I'll check the idea about the dictionary.