detect2
identifies the language of a given text using the DeepL API Free.
detect2(text, auth_key)
A character vector containing the texts to classify. Only UTF-8 encoded plain text is supported. Each element may contain multiple sentences but should not exceed 30 kB.
A string representing the authentication key for the DeepL API Free.
If not provided, the function will attempt to retrieve the key from the environment
variable DEEPL_API_KEY
. You can set this variable using
Sys.setenv(DEEPL_API_KEY = "your_key")
or define it in your .Renviron
file for persistent use.
To use this function, you must obtain an authentication key by registering for a DeepL API Free account at
DeepL API Free. With the Free API, you can translate or detect up to
500,000 characters per month at no cost. To view all supported languages, use available_languages2
.
if (FALSE) { # \dontrun{
detect2("My name is Hans.")
} # }