Function whatlang::detect_lang

source ·
pub fn detect_lang(text: &str) -> Option<Lang>
Expand description

Detect only a language by a given text.

Example

use whatlang::{detect_lang, Lang};
let lang = detect_lang("There is no reason not to learn Esperanto.").unwrap();
assert_eq!(lang, Lang::Eng);