Bastian Venthur
Bastian Venthur

Reputation: 16600

Language detection using deepl's python library

Is there a way to use the deepl Python client library (or raw API) to detect the source language (without translating it)? The marketing blurb on the API website says, detection is available but I can't find it anywhere in the library or API.

Upvotes: 1

Views: 826

Answers (2)

Tim Cadenbach
Tim Cadenbach

Reputation: 1565

Currently, our API does not support "just" detecting the language. Our recommendation would be to try translating a small part of the sentence and use the detected language from the response.

Even if we had a separate /detectLanguage endpoint, using it would be similar to this approach as you had to send some text anyway.

Upvotes: 3

Raavgo
Raavgo

Reputation: 334

I worked quite some time with deepl due to its simplicity, to be honest, I don't think deepl has that feature as a standalone function. But if you send a request to translate you will get the detected language in the response. If you have the starter package you can translate unlimited texts, so this might be a viable workaround.

If you are open to another tool, LibreTranslate has a detect endpoint but the pricing is a bit more expensive. However, you can host it yourself if you have the infrastructure for it. https://libretranslate.com/docs/

Upvotes: 0

Related Questions