Rewrite an algorithm for 3-grams

My algorithm already beats language-detection result now on your test case. The current accuracy is 0.893 vs 0.8584281

Could you please merge it? :)