Phonotext, Latin module: User Guide

The Latin module of Phonotext (version 0.1.1) finds sound repetitions in a Latin text, groups them into chains, measures their strength and highlights them in the text. It uses the same formulas as the Russian module, adjusted for Latin. In the command line and the API the package is called fonometr (“Fonometr” is the working name for the Phonotext updates). This guide explains what exactly the program counts and how to read its output.

1. What the program looks for

The program looks for repeated combinations of consonants and groups them into chains. Separately, it looks at the beginnings of words and at endings placed at the edges of the line.

Phonemotype — a group of consonants that count as one and the same sound for repetition. p and b are one phonemotype, P; t and d are T; c, g, qu are K. The full list is in section 2.

Phonosyllable (biconsonantal phonosyllable) — a concrete sound unit of the text: two consonants of different phonemotypes next to one vowel, within one syllable or across a syllable or word boundary. There are three kinds: consonant + vowel + consonant (mor in mortis), two consonants + vowel (pri in primus), vowel + two consonants (arm in arma).

Phonosyllabeme — the invariant that phonosyllables realize: an unordered pair of consonant phonemotypes, for example T–R. In the Phonotext approach the phonosyllabeme is regarded as the basic unit of the sound organization of the poetic text in the Indo-European languages. In the text it is realized by phonosyllables, its variants: rit, tur, tre, rod. They differ in the order of the consonants, in structure (CVC, CCV, VCC), in the vowel and in inserted sounds — much as a morpheme is realized by its morphs. The pair of terms follows the pattern of phoneme, morpheme, lexeme: the suffix -eme marks the invariant, and the word without it (phonosyllable, like morph) names its realization in the text.

Chain — all phonosyllables of one phonosyllabeme in the text, for example all realizations of T–R: rit, tur, tre, rod… (for K3, all complexes with the same key, an unordered triple of phonemotypes such as T–R–K). Each such place is a link of the chain. Links are related to each other in two ways:

  • echo (equiphony) — the consonants in the same order: condere ~ gentem (K…N, K…N);

  • swap (metaphony) — the consonants in reverse order: sanguine ~ nostro (S…N, N…S).

The program builds two kinds of chains.

Kind What repeats Example
K2 biconsonantal phonosyllables: two consonants of different phonemotypes with one vowel chain P–R: pro, por, pre, per
K3 disyllabic phonosyllabic complexes: three consonants of three different phonemotypes; at most one vowel between neighbouring consonants; one inserted consonant is allowed chain T–R–K: tr…c, d…r…c

K3 complexes are a rarer and more salient repetition. On the Carmen saeculare they proved the most sensitive measure of sound density.

Two more kinds of observation are made separately from the chains.

  • Initial layer — repetitions at the beginnings of content words within one line:

    • classical alliteration — the same first consonant, with the same vowel (MUlta … MUniet) or a different one (Manet … Mente);

    • echo and swap of initial phonosyllables: ramos ~ morabar (R–M / M–R).

  • Ending bracket — two words with the same ending at the edges of the line: the first and the last content word, or the second and the last. transferet, et longam multa vi muniet Albam (Aen. 1.271). In prose the same words would stand side by side (Albam Longam in Livy); verse moves them apart and closes the line with them.

2. How Latin text is turned into sounds

The program reads Latin in the restored classical pronunciation and reduces consonants to phonemotypes.

Phonemotype Letters and combinations
P p, b, ph
F f, v (and u as a consonant)
T t, d, th
S s
N n
M m
L l
R r, rh
J i as a consonant (iam, maior)
K c, k, g, qu, ngu, ch

Reading rules:

  • x is two sounds, K + S; z is T + S.

  • qu and ngu before a vowel are one consonant, K.

  • h does not count as a consonant (it is transparent).

  • Consonantal i — at the beginning of a word before a vowel, between vowels, after a prefix (adiuvo). Consonantal u — as printed in the edition (v) or, as an option, u before a vowel.

  • Diphthongs ae, oe, au are one vowel; eu and ui only in seu, neu, heu, ceu, cui, huic.

  • A double consonant (terra, ille) is one sound.

  • Elision: a final vowel or “vowel + m” before a vowel at the start of the next word drops out: multum ille → mult' ille. Before est, the e drops out: dictum (e)st.

  • -que is split off as a separate word: virum|que.

There are switches for older and later editions:

  • h and ch as a separate phonemotype, H;

  • v as the semivowel W, with a penalty like that for J;

  • ph as F (late Latin);

  • u/v normalization for editions that print u everywhere (uirum, atauis).

3. The chain strength formula

The strength of a chain is the sum of the strengths of all pairs of its links. A pair is stronger the more compact each phonosyllable is, the closer the links are to each other, and the more exactly the sounds match. These are the formulas of Vekshin, Gertsev and Loskot (2021), shared by the Russian and Latin versions.

Σ(chain)=∑i<jw(ai,aj)⋅Pcomb(ai,aj)\Sigma(\text{chain}) = \sum_{i<j} w(a_i, a_j)\cdot P_{comb}(a_i, a_j)
Pcomb(a,b)=IAS(a,b)⋅(1St(a)+1St(b))⋅∑x∈a∑y∈bPel(x,y)P_{comb}(a,b) = \mathrm{IAS}(a,b)\cdot\left(\frac{1}{St(a)}+\frac{1}{St(b)}\right)\cdot\sum_{x\in a}\sum_{y\in b} P_{el}(x,y)
Pel(x,y)=(1Del+1Dw+2)⋅1+δ1+InD(x)+InD(y)P_{el}(x,y) = \left(\frac{1}{Del}+\frac{1}{Dw+2}\right)\cdot\frac{1+\delta}{1+InD(x)+InD(y)}

What the symbols mean:

  • Pₑₗ(x, y) — the correspondence of two sounds. It is counted only for consonants of the same phonemotype or for two vowels. Del is the distance in sounds, Dw the distance in words: the farther apart, the weaker. δ = 1 if the sound is identical (p ~ p) and 0 if only the phonemotype is shared (p ~ b). InD is the position of the sound in its word: sounds nearer the start of the word weigh more.

  • St — the dispersion of a phonosyllable: the product of the distances between its sounds. A compact phonosyllable (pro) is stronger than one split by an inserted sound.

  • IAS (ИАС, index of associative strength) — the associative strength of a phonosyllable, from 0 to 15 points:

Condition Points
sounds are adjacent, with no inserted sound +5
within one word +2
structure: consonant–vowel–consonant / two consonants–vowel / vowel–two consonants +3 / +2 / +1
no J (and no W, if v is read as a semivowel) +4
at the very beginning of a word +1

The IAS of a pair of links is the product of their IAS values, with a bonus for the edge of the line (Last = 1 for the first or last syllable of the line):

IAS(a,b)=10⋅IAS(a)15⋅IAS(b)15⋅(1+Last(a)+Last(b))\mathrm{IAS}(a,b) = 10\cdot\frac{\mathrm{IAS}(a)}{15}\cdot\frac{\mathrm{IAS}(b)}{15}\cdot\bigl(1+Last(a)+Last(b)\bigr)

The same group of consonants can often be read as several phonosyllables (“vibration”). The program takes the main reading: the one with the highest IAS, then the more compact one, the one at the start of the word, the leftmost, the stressed one. In the notation of a link, the weak part is in parentheses, an inserted sound is a hyphen, a word boundary is a vertical bar: (a)rtu, re-|d(e-r).

Adjustments for Latin

Latin grammar itself produces many repetitions: identical endings of agreeing words, -que, function words. So that they do not drown out the author's sound patterning, the strength of a pair is multiplied by a weight w.

Pair of links Weight w
root ~ root 1
root ~ ending 0.5
ending ~ ending inside the line 0.1
ending ~ ending at the edges of the line (1st ~ last or 2nd ~ last content word) 1
link with -que ×0.5 for each
links of the same lexeme (multa ~ multum) pair not counted
link lying entirely in function words (et, in, est, qui…) link not counted

In version 0.1 an “ending” is a link that includes the final consonant of a polysyllabic word (-us, -um, -is, -nt). A proper morphological definition will come in the next version. Full weight at the edges of the line preserves the ending bracket: according to the corpus data, it is a feature of verse, not of grammar.

Strength of a K3 chain — the sum over pairs of complexes: for each of the three phonemotypes, Pₑₗ of its consonants in the two complexes is taken; the three numbers are added and multiplied by the same weight w. Of overlapping complexes, the most compact one is taken.

Stress and ictus. In the hexameter the program scans the line and marks the syllables under the ictus. In other meters and in prose it places the Latin word accent by the penultimate rule. In version 0.1, stress only settles ties between equally good readings of a link; it does not directly affect chain strength.

4. Comparison with chance

Chain strength by itself says little: in any Latin text T, R, S and K repeat often simply because the language has many of them. So the program compares the text with shuffled versions of itself — nulls. The result is given as O/E, the ratio of the observed value to the value expected by chance.

Null What is shuffled What is kept Used for
consonant permutation within the line consonants within the line, within their class (stops, fricatives, sonorants) words, vowels, the line's stock of consonants K2 and K3 chains: are the sounds placed non-randomly?
word permutation content words between lines of a 60-line segment the vocabulary of the text, the number of syllables of each word, first and last place in the line, the ictus initial layer and ending bracket: does the poet bring like-sounding words into one line and into particular positions?

How to read O/E:

  • about 1 — as by chance;

  • above 1 — more repetitions than random placement would give: 1.10 means 10% more;

  • below 1 — fewer repetitions than chance: the author (or the language) avoids them.

Benchmarks from our corpus (22 groups of verse and prose):

  • K2 and K3 against consonant permutation are almost always slightly above 1 (1.02–1.15), in both verse and prose: the language itself builds words out of recurring complexes. A dense text stands out: the Carmen saeculare has K3 = 1.17.

  • Ending bracket (ratio of the frame to the inner pair): 1.4–3.6 in verse, 0.7–0.9 in prose.

  • Metaphony of initial phonosyllables: in verse its share is 1–4 points above chance, in prose at the level of chance.

The null is a random quantity. The more versions, the more precise O/E: 10 versions give a rough estimate, 50–100 a reliable figure.

K2 metaphony index in a sliding frame (version 0.1.1)

Since 8 November 2026 the program measures metaphony separately, in a frame of 5 lines. Pairs of links of one phonosyllabeme no more than four lines apart are split into three kinds: echo (same consonant order and same structure), restructuring (same order, different structure) and swap (reverse order). Metaphony is restructuring and swap together. There are two nulls:

  • word permutation of the same rhythmic type within 60-line segments (number of syllables, accent position, initial vowel, final vowel or -m; the last word of the line stays in place) — tests the arrangement of words;

  • consonant permutation within the line — tests the choice and make-up of words.

Corpus benchmarks (medians of 60-line segments, verse / prose):

  • metaphony against word permutation — 1.013 / 0.998; by group medians verse is almost always separated from prose (AUC 0.93–0.96);

  • swap against consonant permutation — 1.020 / 0.991: prose avoids reverse order, verse lifts this avoidance;

  • echo against word permutation — 0.996 / 1.011: in Latin, echo created by word arrangement is a mark of prose.

On a single 60-line segment verse and prose are separated only weakly (AUC 0.60–0.63); on 300 lines 0.71–0.74, on 600 lines 0.78, on 1,000 lines 0.85. The 5-line frame was chosen by saturation: the contrast grows from a 1-line to a 5-line frame and does not change beyond it.

5. Working on the Latin module page

On the website, open the «латинский модуль» (Latin module) tab of the /fonotext/ section: a form, then a separate results page (its address can be saved; results are kept for 7 days). In the standalone service of the package, the form and the results share one page at the /latin address. To run the service on your own computer, use python -m fonometr --serve; the address is then http://127.0.0.1:8000/latin. The interface is in Russian; below, each label is given in Russian with an English gloss.

  1. Paste the text into the left box («Текст», Text). Verse — line by line, as in the edition; it is better to remove line numbers and headings. Prose can be pasted as continuous text.

  2. Check the settings. The defaults are usually enough; change «u / v» if the edition prints u everywhere.

  3. Click «Анализировать» (Analyse); in the standalone service, «Измерить» (Measure). A 100-line text takes about 25 seconds with 10 null versions; on the website the limit is 300 lines.

  4. Choose chains. In the «Цепи» (Chains) list the ten strongest are checked at once. Uncheck the ones you do not need and check others — no more than ten in all. The «Показать» (Show) switch (on the website, «цепи», chains) selects K2 phonosyllables («фоносиллабы К2/С1»), K3 complexes («комплексы К3/С2») or both («все»).

  5. Look at the highlighted text («Текст с выделениями»). Each chain has its own colour; hover over a highlight to see its chain and the notation of the link. The checkboxes above the text turn on the initial layer and the ending bracket.

Setting Options When to change
«Размер» (Meter) detect · hexameter · other verse · prose “Detect” recognizes the hexameter by itself (if more than 60% of lines scan) and prose (long lines). For elegiac couplets and lyric meters, choose “other verse”. Prose is cut into pseudo-lines of 36 letters
u / v as in the edition · u before a vowel → v the second for editions with uirum, atauis
h transparent · h and ch are phonemotype H the second if you treat h as a full consonant
v F · semivowel W W if v is read as [w] and weakened like J
ph P (classical) · F (late) F for late Latin
«Окончания на краях строки» (Endings at line edges) full weight · as inside (×0.1) the second, to compare chains with and without the bracket
«Нуль-версий» (Null versions) 0–100 (on the website 5, 10 or 20) 0 — no O/E, faster; 50–100 — for a reliable figure

Below is the page for the first 20 lines of the Carmen saeculare: the ten strongest K2 chains are selected; the repetition of initial consonants and the ending bracket are switched on.

Latin module results page: Carmen saeculare

6. Reading the results

Summary

Summary line What it means
«Строк» (Lines) number of lines, the detected meter, and what is taken as stress (ictus or word accent)
«Цепи К2/С1», «Цепи К3/С2» (K2 / K3 chains) number of chains, their total strength, and the ratio to consonant permutation (O/E)
«Метафония начальных фоносиллабов» (Metaphony of initial phonosyllables) the share of swaps among repetitions of word beginnings, and the same share by chance
«Повтор начальных согласных» (Repetition of initial consonants) classical alliteration against chance, separately in adjacent words, and the share of repetitions with the same vowel
«Скобка окончаний» (Ending bracket) identical endings in the frame of the line and in the inner pair (2nd ~ second-to-last) against chance, and their ratio. Above 1 means the verse moves endings to the edges

The red note «мало пар» (too few pairs) means the text is too short for this measure. The ending bracket and the metaphony of initial phonosyllables are corpus measures: they become stable at about 1,000 lines. On the first 120 lines of the Aeneid the bracket gives 0.36; on 1,700 lines, 1.6.

The line «Метафония К2/С1 (окно 5 строк)» (K2 metaphony, 5-line frame) shows the three figures from section 4, each next to the corpus medians for verse and prose: metaphony against word permutation, swap against consonant permutation, and echo against word permutation. A red note appears if the text has fewer than 600 lines. In the API this is the metaphony block (M_words, swap_cons, Q_words, scale).

Chain list

Each row of the list is one chain: its type (K2 or K3), its phonemotype key (T–R, T–R–K), the number of links, the strength, and the notation of the first links. Chains are sorted by decreasing strength. K3 strength is an order of magnitude lower than K2 strength, so in the “both” mode the complexes come at the end; to compare complexes with each other, choose «комплексы К3/С2» (K3 complexes).

Links are written in phonosyllabic transcription: kw = qu, k = c, w = v. An inserted sound is a hyphen, a word boundary is a vertical bar, the weak part of a vibrating link is in parentheses: et|k(u-t) is the link et|c across a word boundary, with the weak reading cult.

Highlights in the text

What it looks like What it means
coloured background a link of a selected chain; the colour matches the square in the list
dashed underline over the background the consonants of the link are in the reverse order of the chain's first link (swap)
dark bar underneath a K3 complex
dotted outline the letter belongs to links of several selected chains (the background is that of the first)
wavy line repetition of an initial consonant; red — with the same vowel
double line echo of initial phonosyllables; purple — swap
bold dark-red letters the endings of a bracket (frame or “2nd ~ last”)

The program finds all connections, while a person hears the highlighted ones. On G.V. Vekshin's markup of the Carmen saeculare, the program's ten strongest chains cover 57% of his links, twenty chains cover 72%, all chains 78%. His main chains T–R, R–K and P–R are ranked 1st, 2nd and 4th by the program. So the chain list is a proposal for reading, not a finished markup.

7. Command line and API

For batch processing, the same calculations are available from the command line and through the API.

Command line. The text is a UTF-8 file:

python -m fonometr carmen.txt --latin --top 10
python -m fonometr aeneis1.txt --latin --meter hexameter --n-null 50
python -m fonometr catilina.txt --latin --meter prose --json > result.json
Option Meaning
--latin Latin text
--meter auto (default), hexameter, verse, prose
--uv edition (default) or normalize
--n-null number of null versions (up to 50)
--top how many chains to print
--json full result in JSON, with letter positions for highlighting

Sample output for the Carmen saeculare (the program prints its labels in Russian: «Строк» = lines, «ударение» = stress, «доля … (случай …)» = share … (chance …), «мало данных» = too little data):

Строк 76 (verse; ударение: accent)
К2/С1 4091.4 O/E 1.104 К3/С2 65.8 O/E 1.240
K2 T–R Σ= 547.54 N= 59 rit tur (a)rtu (a)tre rod (a)tru re-|d(e-r) (de-)ret
K2 R–K Σ= 418.74 N= 55 ru-|kw r|e-|k (kwae|-)rek (a)kro (i)rgi ro-|kw re|k ker(e|k)
K2 T–K Σ= 369.08 N= 60 kid(u-|k) dek et|k(u-t) te|kw (e)kta ka-t di-|kw dik
K2 P–R Σ= 324.57 N= 38 (ae)|pre por pro ri-|p urb(e|r) per (re)|par (a)|pro(b)
Метафония начальных фоносиллабов: доля 0.500 (случай 0.292)
Скобка окончаний: мало данных (надёжно примерно от 1000 строк)

API. A POST /api/v1/latin request with a JSON body:

{"text": "Phoebe silvarumque potens Diana, ...",
"params": {"meter": "auto", "uv": "edition", "h": "A", "v": "F", "ph": "P",
"edge_full": true, "n_null": 10}}

The response contains:

  • meta — number of lines, meter, kind of stress;

  • totals and null — K2 and K3 strength and their O/E;

  • chains — chains by decreasing strength; each link has a line number, letter positions (spans, cons_spans), consonant order (echo / swap), and an ending flag;

  • marks — initial-layer pairs and ending brackets with letter positions;

  • initial — initial-layer and bracket measures with pair counts.

The check against the manual markup of the Carmen saeculare is run with python tools/latin_eval.py.

8. Limitations and tips

Limitations of version 0.1.

  • An “ending” is detected crudely, by the final consonant: for now the program cannot tell Roma ~ -rum from dominus ~ -us. The ending bracket compares the last two letters of the word and does not distinguish agreement from chance coincidence.

  • Stress outside the hexameter is approximate: the natural length of the penultimate syllable is guessed from suffixes (-atus, -orum). The hexameter scanner parses about 83% of lines unambiguously; in the rest the ictus is not marked.

  • The pentameter and lyric meters are not scanned: word accent is used for them.

  • A link across a word boundary can include a function word (et|culti). Only a link lying entirely in function words is excluded.

  • There is no Latin Equiphonometer yet (homoeoteleuton, internal rhyme).

Tips.

  • For reading chains and comparing them with manual markup, texts of 20 to 100 lines work best: a stanza, an ode, an episode. On a long text the chains become very long and the highlights merge.

  • For the ending bracket and the metaphony of initial phonosyllables, on the contrary, take a whole book or poem, 1,000 lines or more.

  • Compare texts by O/E, not by strength: strength depends on the length of the text.

  • Switch the h, v and ph options to test robustness: if a conclusion holds under every option, it can be trusted.

  • The «Окончания на краях строки» (Endings at line edges) switch shows which chains rest on the bracket: compare the lists under “full weight” and “as inside”.