How the tools work

The methods behind the tools of the PHI Latin Texts server: what each tool counts, in which order, and where it stops. The numbers on this page come from the server's code, so they are the ones it uses now.

Tools: the data under all tools · search_corpus · find_words and check_words · find_distinctive_words · get_word_profile · get_style_profile · compare_style · find_shared_phrases · the lookup tools · sources

The data under all tools

Every tool reads the same texts: the PHI Latin corpus, in the spelling of each printed edition.

Forms that belong to two words

Many forms belong to more than one lemma. malis can be from malus, malum or malo. The server does not read the sentence. It gives each form a weight for each of its lemmas: the share of that form's occurrences, over the whole corpus, that it takes to be that lemma's.

The weights come from a statistical model fitted once to the whole corpus (expectation–maximization, 4 rounds). It starts from:

For the hardest forms the model picks the right word about 7 times in 10. A count that includes shared forms is an estimate, and the answers mark it so.

Two lemmas spelled the same are one entry. effero “carry out” (efferre) and effero “make wild” (efferare) share one entry and one gloss, so a check of elata shows the gloss “make wild” beside the likely lemma elatus. cum is not split into the preposition and the conjunction.

Finds where a string of letters, or every form of a lemma, occurs, and counts the matches by author and work.

Letter search (query)

  1. The query is folded like the text. Spaces split it into words; a space matches any run of spaces and punctuation, also across a line end.
  2. # at the start or end ties the match to the start or end of a word. Without it, amor also matches clamor.
  3. . is one unknown letter. A query may have at most 8 of them, and at least 2 known letters.
  4. The server scans the folded text once, start to end. A match never runs from one work into the next.
  5. It stops after 50,000 matches. The answer then says it stopped, and the counts by author cover only the matches found before that point. They lean toward the early authors, because the corpus is in order of author number.

Lemma search (lemma)

  1. The server takes every form that the lemma can have.
  2. It drops a form whose weight for this lemma is under 10%: that form is mostly another word, and its lines would bury the lemma's own. The answer lists the dropped forms.
  3. It finds every occurrence of each kept form. There is no cap.
  4. The estimate is the sum, over the forms, of the count times the weight. Forms with a weight under 90% are named in a note as shared with another word.

Two words together (near, near_lemma)

The server finds both terms, then keeps each match of the first that has a match of the second within within lines (default 1, at most 10), in the same work. The same letters at the same place do not count as the second word.

Which lines come back

Example (2026-10-21): /api/v1/search?lemma=lugeo&limit=0 gives 423 matches, about 419 by weight. lugere 71, luget 31, luxit 20 (weight 0.95). luctus and luctu are dropped: almost all of them are the noun luctus. The letters #lug give 524 matches, because they also find lugubris and other words.

find_words and check_words

find_words

  1. The server reads the English gloss of every lemma.
  2. It keeps a lemma if the English word or phrase stands in the gloss as whole words, in order. A final -s in the gloss counts: “griefs” matches “grief”.
  3. Lemmas whose main gloss matches come first. Lemmas that match only in a secondary sense come after them.
  4. Within each group, the commonest lemma comes first, by its estimated count in the corpus.

It returns 25 lemmas unless you ask for more, and at most 60. A gloss lists every sense of a word, so some lemmas will not fit the meaning you want.

Example (2026-10-21): /api/v1/words?english=grief finds 32 lemmas: dolor (3,919), doleo (932), luctus (727), desiderium (680), scindo (374, “tear in rage/grief/despair”) …

check_words

For each word (at most 40 in one call), the server says whether it is a lemma, with its gloss and estimated count, and whether it is a form in the texts, with its count and the lemmas it can belong to, each with its weight. A word that is neither gets lemmas that begin with the same letters.

Example (2026-10-21): elata occurs 54 times: elatus 0.81, elate 0.12, effero 0.06. lugent occurs 15 times, all lugeo.

find_distinctive_words

Finds the words of an author, or of one work, that the other texts seldom use.

  1. Count the target. Each form in the target adds its weight to each of its lemmas. A form with no lemma is counted as a form, in a separate list.
  2. Choose the comparison texts. all (default): every other text. earlier: authors whose dates fall before the target's. same_genre: texts of the target's genre. The target itself is left out. If the target is one work, the author's other works stay in the comparison.
  3. Count the comparison texts the same way, author by author. An author uses a lemma if the estimated count is 0.5 or more.
  4. Join lemmas that come from the same forms. If two lemmas get their count in the target from the same forms, they are one row. The Lucan example below has bellum / bellus: every form of bellus in Lucan is also a form of bellum.
  5. Sort. rare (default): fewest other authors first, then fewest uses in the comparison texts, then most uses in the target. keyness: Dunning's log-likelihood (G²), highest first. It compares the word's rate in the target with its rate in the comparison texts, and it is high when the target uses the word much more often than its size predicts. Only words used 2 times or more, and more often than expected, enter this list.
  6. Set names apart. If more than half of a word's uses in the target begin with a capital inside a sentence, the word goes in a list of names (at most 10).

Each row gives the count in the target, the forms used, the uses elsewhere, the number of other authors, the earliest 3 of them with dates, and 2 references in the target. It returns 30 rows unless you ask for more, and at most 100.

Dunning's log-likelihood (G²)

G² asks: if the target and the comparison texts used the word at the same rate, how surprising would the counts be? Let a be the uses of the word in the target and c the words in the target; b and d are the same for the comparison texts.

  1. The expected uses at one shared rate are E1 = c(a + b) / (c + d) in the target and E2 = d(a + b) / (c + d) in the comparison texts.
  2. G² = 2 [ a ln(a / E1) + b ln(b / E2) ]. A count of 0 adds nothing.
  3. The server gives G² a minus sign when the target uses the word less than the comparison texts. Only positive values enter the list.

This is the short form used in corpus linguistics (Rayson and Garside 2000). Dunning proposed it because the more familiar chi-square test overstates the importance of rare words, and most words in a corpus are rare.

How to read the number:

The corpus has few texts after AD 200. When less than 20% of the comparison words are late, the answer says so: a word of late Latin can look rare only because few late texts are in the corpus.

Example (2026-10-21), sort=rare: in Maximianus (4,220 words, compared with 368 authors and 8.1 million words), scabidus and insuperatus occur in no other author. sort=keyness: Lucan's first words are fatum (G² 987), unda (537), bellum / bellus (492), aequor (443).

get_word_profile

Gives the use of one lemma across authors, eras and genres.

  1. The server takes every occurrence of every form of the lemma. Each one adds the form's weight to the totals of its author, era and genre. The part that comes from forms of this lemma alone is given as the certain count.
  2. A rate is uses per million words of that author, era or genre.
  3. Eras: Archaic (to c. 90 BC), Late Republican (to 43 BC), Augustan (to AD 14), Julio-Claudian (to AD 68), Flavian (to AD 96), Trajanic–Antonine (to c. AD 200), Late, and Undated. An author belongs to one era.
  4. The list of highest rates has only authors with 10,000 words or more. A rate from a fragment of 300 words is noise. Smaller authors are named with their counts and no rate.
  5. The earliest and latest users are the 3 dated authors at each end with an estimated count of 0.5 or more.

The answer also lists the lemma's forms with their counts and weights, and the other lemmas that share its forms.

Example (2026-10-21): senectus occurs about 912 times (716 certain) in 76 authors. The rate is highest in Philosophy (338 per million) and, among authors, in Juvenal (544).

get_style_profile

Measures habits of style in an author or a work, and compares each with other works.

The measures

The moving-average type–token ratio (MATTR)

The plain type–token ratio is the number of different forms divided by the number of words. It falls as a text gets longer, because the common words come again and again and each new page brings fewer new words. A long work then looks poorer in words than a short one, and two texts of different length cannot be compared. MATTR removes this effect.

  1. The server takes the first 500 words and divides the number of different forms in them by 500.
  2. It moves the window on by one word, and divides again. A text of n words has n − 500 + 1 windows.
  3. MATTR is the mean over all the windows.

Each window has the same length, so values from a short work and a long one can be compared.

Example (2026-10-22): the mean of 305 works is 0.69. Tacitus' Annales has 0.82 (z +1.5): in 500 words, about 410 different forms. Lucretius has 0.71 (z +0.1).

The comparison

  1. The comparison works are all works of 3,000 words or more, or with compare_to=same_genre only those of the target's genre. There must be 5 or more.
  2. An author target leaves all that author's works out of the comparison. A work target leaves out only that work.
  3. For each measure, the server takes the mean and standard deviation over the comparison works and gives the target's z-score: how many standard deviations it lies from the mean.
  4. The answer names the 8 measures furthest from the mean.

Genre, verse or prose, and the editor's punctuation move these numbers as much as the author does. Compare like with like.

Example (2026-10-21): Sallust's Catilina against 25 works of history: sed 9.4 per 1,000 words, mean 3.8 (z +2.9); atque/ac 16.3, mean 8.1 (z +2.0); et 11.5, mean 27.2 (z −1.9).

compare_style

Measures how near an author or a work is in style to other authors, with Burrows' Delta.

  1. The server takes the most frequent forms of the whole corpus: 150 unless you ask for another number, from 30 to 300.
  2. For each author, it computes the rate of each form: uses divided by the author's words.
  3. The target is taken out of its own author first. A work of Sallust is compared with the rest of Sallust, not with all of Sallust.
  4. The population is every author with 5,000 words or more. For each form, the server takes the mean and standard deviation of the rate over the population, and turns each rate into a z-score.
  5. Delta between the target and an author is the mean, over the forms, of the absolute difference between their z-scores. Smaller is nearer.
  6. With candidates (at most 20), the server ranks them. Without, it lists the 12 nearest authors in the population. The answer also gives the median Delta from the target to the whole population, as a scale.

Delta is not reliable for a target under about 1,500 to 2,000 words, and the answer says so. A candidate under 5,000 words gets a note. Genre and verse or prose move Delta as much as the author: a poem is near other poems.

Burrows' Delta

Authors differ most in the common words they use without thought: et, in, non, est, -que. These words do not depend much on the subject, and an author's rates of them stay much the same from work to work. Burrows (2002) made a distance from them.

Example (2026-10-21): Sallust's Catilina (10,673 words), against 81 authors, median 1.11: the rest of Sallust 0.51, Livy 0.77, Tacitus 0.86, Caesar 0.87, Cicero 0.96.

find_shared_phrases

Finds the phrases that two texts share, the rarest in the corpus first.

  1. Make the phrases. Every run of length words in a row (2 to 6, default 3), in the folded spelling, within one work. A phrase can run across a line end and across punctuation.
  2. Drop common phrases. A phrase made only of the 100 most frequent forms of the corpus (et, in, non, est …) is dropped. One less common word keeps it.
  3. Find the shared ones. The server lists the phrases of the smaller text, then looks for each in the larger text. The smaller text may have at most 3,000,000 words; for two larger texts, name a work.
  4. Count each one in the corpus. The server takes the 2,000 shared phrases with the rarest words. For each, it follows the occurrences of its rarest word (at most 20,000) and counts where the whole phrase occurs: in the corpus, in how many other authors, and in how many grammarians and commentators. These quote other authors, so they are counted apart.
  5. Sort. Fewest other authors first, then fewest occurrences in the corpus, then most uses in the two texts.
  6. Add references: the first place of the phrase in each text.

It returns 30 phrases unless you ask for more, and at most 100. The forms must match exactly: proiecit in undas does not match proiecit in undis. A shared phrase is not proof of borrowing; read both lines.

Example (2026-10-21): the Aeneid and Lucan share 63 phrases of 3 words. First: hoc solamen erat (Aen. 10.859, BC 7.181), proiecit in undas (Aen. 5.859, BC 6.401), quo fata trahunt (Aen. 5.709, BC 2.287). No other author has them.

The lookup tools

Sources

Published methods

Questions about a method: [email protected].