ILanguageIdentifier<T>
Interfaces · AiDotNet.Interfaces
Defines the contract for spoken language identification from audio.
Known implementations: ECAPATDNNLanguageIdentifier<T>, VoxLingua107Identifier<T>, Wav2Vec2LanguageIdentifier<T>
For Beginners
This is like having a friend who can tell you “that’s French!” or “that sounds like Mandarin!” just from hearing it.
How it works:
- Extract acoustic features (phonemes, prosody, rhythm)
- Compare to language models trained on many languages
- Return the most likely language(s)
Applications:
- Call routing in multilingual call centers
- Automatic subtitle language selection
- Content moderation (filter by language)
- Multilingual speech recognition (select correct model)
- Immigration/border control voice analysis
Challenges:
- Code-switching (mixing languages mid-sentence)
- Accented speech (Spanish with American accent)
- Closely related languages (Norwegian vs Swedish)
- Short utterances (harder to identify with less audio)
How It Works
Language Identification (LID) determines which language is being spoken in an audio recording. This is different from speech recognition - we’re identifying the language, not transcribing the words.
Properties
| Property | Summary |
|---|---|
IReadOnlyList<string> SupportedLanguages { get; } |
Gets the list of languages this model can identify. |
int SampleRate { get; } |
Gets the sample rate this identifier operates at. |
Methods
| Method | Summary |
|---|---|
IReadOnlyDictionary<string, T> GetLanguageProbabilities(Tensor<T> audio) |
Gets probabilities for all supported languages. |
IReadOnlyList<LanguageSegment<T>> IdentifyLanguageSegments(Tensor<T> audio, int windowSizeMs) |
Identifies language with time segmentation (for multilingual audio). |
IReadOnlyList<ValueTuple<string, T>> GetTopLanguages(Tensor<T> audio, int topN) |
Gets the top-N most likely languages. |
LanguageResult<T> IdentifyLanguage(Tensor<T> audio) |
Identifies the language spoken in audio. |
ValueTuple<bool, T> AreSameLanguage(Tensor<T> audio1, Tensor<T> audio2) |
Checks if two audio samples are in the same language. |
string GetLanguageDisplayName(string languageCode) |
Gets the display name for a language code. |