detect identifies the language of a given text using the DeepL API Pro.

detect(text, auth_key)

Arguments

text

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.

auth_key

A string representing the authentication key for the DeepL API Pro. 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.

Details

To use this function, you must obtain an authentication key by registering for a DeepL API Pro account at DeepL API Pro. This service may incur costs depending on the number of characters submitted. To view all supported languages, use available_languages.

Examples

if (FALSE) { # \dontrun{
detect("My name is Hans.")
} # }