1001Ferramentas
🌍Text

Detector de Idioma (trigrama)

Adivinha PT/EN/ES por presença de trigramas comuns.

Idioma

Guessing a language from three-letter chunks

You have a pile of mixed texts and need to separate Portuguese from English and Spanish before sending them to translation or into a search index. For a few paragraphs you can just look. For three hundred rows of a CSV you cannot. This page makes the cheapest guess there is: it looks for three-letter sequences typical of each language and picks whichever scores highest.

The list is fixed and short, six trigrams per language. Portuguese uses ção, que, ent, ade, par and ndo; English uses the, ing, and, ion, ent and tio; Spanish uses que, ent, aci, ado, ist and par. Counts are raw, with no length normalisation and no probability. Portuguese and Spanish share three trigrams, so ties are common, and every tie resolves to Portuguese, which comes first in the list. A three-way zero resolves the same way.

Paste at least a paragraph. The short English sample that ships in the box is exactly the case where no trigram matches, which is why it comes out labelled Portuguese. Only three languages exist in the model, so French, Italian or German get forced into one of them with no warning. Use it for rough triage and never for automatic content routing. Everything runs in the browser.

Frequently asked questions

Why is the English sample labelled Portuguese?
None of the eighteen trigrams occur in it, all three languages tie at zero, and the tie-break follows list order, which starts with Portuguese. A real paragraph fixes it.
Does it detect French?
No. The model only knows Portuguese, English and Spanish, and anything else is pushed into one of those three.
How much text do I need?
The more the better. Below about thirty words there is a real chance that no trigram matches at all, and the answer means nothing.

Related Tools