This function attempts to detect the language of a text string.
It implements a simple n-gram based approach that doesn't require
additional packages.
Usage
detect_lang(text, sample_size = 1000)
Arguments
- text
Text string to analyze
- sample_size
Maximum number of characters to sample for language detection
Value
Character string containing the ISO 639-1 language code
Examples
if (FALSE) { # \dontrun{
lang <- detect_lang("This is English text")
# Returns "en"
} # }