C++ port of the language-detection library in Java, by @shuyo