Expand description
Which language a text is in: music21’s Trigram, and its
LanguageDetector with the language-detection feature.
Which language a text is in, by the letters that follow each pair of
letters: music21’s text.LanguageDetector and text.Trigram.
Each language is known by a long text in it, the excerpts music21
carries from Project Gutenberg (in src/features/language/, as music21
has them). A text is compared with each by how alike their counts of
letter-after-two-letters are, and is in the language it is most like.
A Trigram needs none of that and is always here; the excerpts, and
what reads a text against them, come with the language-detection
feature.
Structs§
- Trigram
- How often each letter follows each pair of letters in a text: music21’s
Trigram.
Constants§
- LANGUAGE_
CODES - The languages known, in music21’s order: English, French, Italian, German, Chinese, Latin and Dutch.
Functions§
- known_
trigram language-detection - The trigrams of a language’s excerpt, by its code: what music21’s
LanguageDetector.trigramsholds. - language_
name - The name of each language music21 knows, by its code.
- most_
likely_ language language-detection - The language a text is most like, by its code, or nothing for an empty
text or one like none of them: music21’s
LanguageDetector.mostLikelyLanguage. Where two are as alike, the first ofLANGUAGE_CODESwins. - most_
likely_ language_ numeric language-detection - The language a text is most like, as one more than its place in
LANGUAGE_CODES, or nought for an empty text: music21’smostLikelyLanguageNumeric.