Function cld2::detect_language [] [src]

pub fn detect_language(
    text: &str,
    format: Format
) -> (Option<Lang>, Reliability)

Detect the language of the input text.

use cld2::{detect_language, Format, Reliable, Unreliable, Lang};

let text = "It is an ancient Mariner,
And he stoppeth one of three.
'By thy long grey beard and glittering eye,
Now wherefore stopp'st thou me?";

assert_eq!((Some(Lang("en")), Reliable),
           detect_language(text, Format::Text));

assert_eq!((None, Unreliable),
           detect_language("blah", Format::Html));