LanguageDetector class (C#)

This code is an implementation of statistical language analysis using 3grams. Based on the idea and JavaScript code developed by Rich Tibbett (https://github.com/richtr/guessLanguage.js)

C# version by Sasvári Tamás 2013.01.30

Download source code here

Usage

LanguageDetector ld = new LanguageDetector();
string lanCode = ld.Detect("this is an example text in english");
if (lanCode == null) throw new Exception("Cannot detect language");
string languageNaturalName = ld.GetLanguageNameByCode(lanCode); //returns "English" for language code "en"

Feel free to comment