
Detect the language of text within a request
gl_translate_detect(string)
A character vector of text to detect language for
A tibble of the detected languages with columns confidence
, isReliable
, language
, and text
of length equal to the vector of text you passed in.
Consider using library(cld2)
and cld2::detect_language
instead offline,
since that is free and local without needing a paid API call.
gl_translate also returns a detection of the language, so you could also wish to do it in one step via that function.
https://cloud.google.com/translate/docs/reference/detect
Other translations: gl_translate_languages
,
gl_translate
# NOT RUN {
# }
# NOT RUN {
gl_translate_detect("katten sidder p<U+00E5> m<U+00E5>tten")
# Detecting language: 39 characters - katten sidder p<U+00E5> m<U+00E5>tten...
# confidence isReliable language text
# 1 0.536223 FALSE da katten sidder p<U+00E5> m<U+00E5>tten
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab