Zubnet AIApprendreWiki › Language Detection
Using AI

Language Detection

Language Identification, LangID
Identifier automatiquement dans quelle langue un texte est écrit. « Bonjour le monde » → Français. « こんにちは世界 » → Japonais. Les modèles modernes peuvent distinguer 100+ langues à partir de juste quelques mots, gérer le texte à langues mélangées (code-switching) et identifier des langues étroitement reliées (norvégien vs. danois, malais vs. indonésien).

Pourquoi c'est important

La détection de langue est la première étape essentielle dans n'importe quel pipeline multilingue : tu dois savoir dans quelle langue est l'entrée avant de pouvoir la traduire, la router vers le bon modèle, ou appliquer un traitement spécifique à la langue. Elle est utilisée dans les moteurs de recherche, le routage de support client, la modération de contenu, et chaque système qui traite du texte d'utilisateurs autour du monde.

Deep Dive

Simple approaches use character n-gram statistics: each language has distinctive character patterns ("th" is common in English, "tion" in French, "ung" in German). FastText's language identification model uses character n-grams with a shallow neural network and can identify 176 languages with high accuracy from as little as one sentence. For very short text (a few words), accuracy drops because there's not enough signal.

Hard Cases

Some language pairs are extremely difficult to distinguish: Serbian (Cyrillic) vs. Serbian (Latin) vs. Croatian vs. Bosnian share most vocabulary and grammar. Simplified vs. Traditional Chinese requires examining specific character choices. Short ambiguous text like "no" could be English, Spanish, Italian, or Portuguese. Code-switched text ("I went to the tienda to buy leche") mixes languages within a sentence. Robust systems handle these edge cases through statistical confidence scores rather than hard classification.

In Practice

For most applications, Google's CLD3, FastText's lid.176.bin, or the langdetect Python library provide sufficient accuracy. LLMs can also detect language as a side effect of their training, though using a 70B model for language detection is like using a chainsaw to cut butter. The practical architecture: fast language detection first (FastText, <1ms), then route to language-specific processing.

Concepts liés

← Tous les termes
ESC