How the tools work
The methods behind the tools of the PHI Greek Inscriptions 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_inscriptions · find_parallels · the lookup tools
The data under all tools
Every tool reads the same texts: the PHI corpus of Greek inscriptions, in betacode, as the printed editions give them. Betacode writes Greek in Latin letters: DHMOS is δημος.
The search text
For search and parallels, the server keeps one long string of letters for the whole corpus, made once from the texts.
- Letters only. Capitals, brackets and other editorial marks do not count. Accents and breathings stay beside their letters, but only a search with
accents="match" reads them. The archaic letters stigma, koppa and sampi are letters of their own.
- Each letter keeps its status in the edition. The table shows each status and the layers that read it.
- Words. A space, a line end and the marks
. , ; : divide words. A hyphen at a line end joins the word to the next line.
- No dictionary words. The server has no lemmas and does not parse the text. It does not know that λαμβάνω and ἔλαβον are one verb, or that δᾶμος and δῆμος are one word in two dialects. Each spelling is a different string of letters.
- Latin passages (about one inscription in eight has some) are kept apart from the Greek. Their letters are folded: lowercase, u for v, i for j.
| Status of a letter | In the edition | on_stone | full | restored |
| Read on the stone | α | yes | yes | no |
| Uncertain reading | ạ | yes | yes | no |
| Erased in antiquity, still legible | ⟦α⟧ | yes | yes | no |
| Restored by the editor | [α] | no | yes | yes |
| Abbreviation written out | (α) | no | yes | yes |
| Letter the cutter left out, added by the editor | ⟨α⟩ | no | yes | yes |
| Lost: the place is known, the letter is not | [.] | no | no | no |
The editor's notes inside the text are a fourth layer, apparatus, and no other layer reads them.
Dates
The corpus gives dates as text (“2nd/3rd c. AD”, “Hellenistic period”, “287-281 BC”). The server holds each date as a range of years, with years BC as negative numbers: “2nd/3rd c. AD” is AD 101 to 300, and “Hellenistic period” is 323 to 31 BC. A table made once for the whole corpus gives the range of each date text. A text with no date, or with only one end, has no range.
A split year gives the era when the date text does not. A year that counts down (345/4) is BC, because years BC grow smaller; a year that counts up (170/1) is AD.
Places
Each text has a region, a subregion and a site. The old database spelled some sites in more than one way (“Samos Isl.”, “Ath.”, “Antiochia”). A table of 362 spellings joins each to one name (Samos, Athens, Antiocheia), in the Greek form the corpus uses: k for c, -eia for -ia. The site filter uses these names; list_regions gives them.
search_inscriptions
Finds where a string of letters stands, and counts the inscriptions with a match by region, publication, century and word.
The query
- The server reads the query as Greek. Unicode Greek is turned into betacode. Latin letters are read as betacode, never as English:
demos is δεμος, not δῆμος. Brackets in the query do not count, and accents and breathings count only with accents="match" (below).
| separates alternatives (λαβ|ληψ|λαμβαν). A query may have at most 24, and a match of any one is a match.
. is one unknown letter. A query may have at most 8, all its alternatives together.
- With
script="latin", the query is read as Latin and folded like the Latin passages. With script="both", the server looks for the Greek reading and the Latin reading.
The scan
- The server joins the alternatives into one state machine and reads the search text once, start to end. A match never runs from one inscription into the next.
- Layer. A match counts only if the layer reads each letter it covers. With
on_stone, a match that needs one restored letter does not count. The default is full.
- Place in the word (
match_at). The default is anywhere, because many texts have no word division. word_start needs a word division, or the start of the text, before the match; word_end needs one after it; whole_word needs both. A lost or barred letter next to the match also counts as the edge of a word, because the rest of the word is not there to read.
- Filters (region, site, publication, date, note) choose the inscriptions first. The scan reads only those.
- The scan stops at 300,000 matches. The answer then says “more than”, and all counts cover only the matches found before that point. They lean toward the publications that come first in the corpus.
Accents (accents)
By default the search ignores accents and breathings. With accents="match" it reads them, by the rule of the old PHI site:
- The scan finds the letters as usual.
- For each match, the server reads the marks on each letter in the text: breathings, accents, iota subscript and diaeresis. A capital has its marks before it (
*)/A).
- A mark that the query puts on a letter must stand on that letter in the text. A letter that the query gives without marks matches any.
EA/N finds ἐάν but not ἐὰν; EAN finds both. A query with no marks gives the same matches as without the rule.
- The rule also applies to
near.
In betacode, | separates alternatives, so an iota subscript can only be given in Unicode Greek (τῇ). The dot under a letter is not a mark here; the layer says the reading is uncertain.
About one inscription in seven is printed with no accents at all, and an accented query does not find them. Use the rule to tell accented forms apart, not to count a word.
Example (2026-10-22): EA/N as a whole word gives 725 matches with accents="match", EA\N 2,456, and EAN 3,263 with no rule.
Two strings together (near)
The server scans for the second string only in the inscriptions that have a match of the first. It keeps a match of the first if the second stands within within lines of it (default 0, the same line; at most 20). Lines are counted by the line ends of the text, from the start of the inscription; faces and columns run on.
Example (2026-10-21): θεοις with near="ανεθηκ" in the same line gives 53 matches in 53 inscriptions: θεοις 51, θεοισι 2.
The counts
- By region and by publication the answer counts inscriptions, not matches. It shows the 15 largest.
- By word. For each match the server finds the whole word it stands in, by the word rules above, and counts each form. This covers the first 50,000 matches.
… marks a word that runs into lost or barred letters: the rest of it is not there to read.
- By century. An inscription dated to a range counts in each century the range touches, by its share of the years. A text of 400–201 BC counts one half in the 4th century and one half in the 3rd. A text with no range, or with a range of more than 300 years, is not counted, and the answer says how many it left out. A century with less than half an inscription is not shown.
- The rate beside each century is the count per 1,000 dated inscriptions of that century in the whole corpus, counted the same way. The corpus has far more Hellenistic and Imperial texts than Archaic ones, so the count alone misleads.
- Earliest and latest. The answer names the 3 dated inscriptions whose range ends first, and the 3 whose range begins last. Ranges of more than 300 years are left out.
Example (2026-10-21): the stem ψηφισμ at word_start gives 5,609 matches in 3,802 inscriptions: ψηφισμα 3,945, ψηφισματα 766, ψηφισματι 374. The 3rd century BC has the most, 970 inscriptions, and also the highest rate, 52.9 per 1,000. The 5th century BC has 39.6, a rate of 4.8.
Example (2026-10-21): βουλη as a whole word gives 4,781 matches with layer=full and 3,070 with layer=on_stone. The difference is mostly matches that need a letter the editor restored.
A query in Latin letters
A person who types demos means δῆμος, but the search reads δεμος. So for a Greek search in Latin letters, the server also tries the query as an English spelling of Greek: e as ε or η, o as ο or ω, th as θ, ch as χ, ph as φ, ps as ψ, u as υ or ου, and -us at the end as -ος. It counts at most 16 such readings.
- The answer names a reading only if it has at least a tenth of the matches of the betacode reading, and at least a hundredth of the matches of the best reading. It names at most 4.
- The word WARNING comes first when a reading has more matches than the betacode reading.
- The counts in the answer are always those of the betacode reading. The server does not choose for you.
- If the Greek search finds nothing, but the Latin passages have the letters, the answer says so.
Example (2026-10-21): demos gives 293 matches of δεμος, most of them in Attica before 400 BC (δεμοσιον 77, δεμος 36) and in names (χαιρεδεμος 14). The answer adds that δημος has 11,225.
Which matches come back
- Matches come in the order of the corpus, by publication, not by relevance. A page has 20 matches unless you ask for more, and at most 100.
sort="oldest" orders the matches by the start of each range, and sort="newest" by its end. Undated texts come last. Matches of one date keep the order of the corpus.
- Each match gives its line and a short context. The context is not a quotation: open the inscription to quote it.
find_parallels
Finds the inscriptions that share sequences of words with one inscription: formulae, an epigram cut again, the same text in two publications, a parallel for a gap.
- The server splits the inscription into words, by the rules of the search text. A word is whole only if the layer reads all its letters and no lost letter touches it. The layer is
on_stone unless you ask for full.
- It takes each sequence of
length words (default 3, from 2 to 6) in which every word is whole. A sequence that occurs twice in the inscription counts once.
- It reads every other inscription once, splits it the same way, and notes which of these sequences it has.
- For each sequence it counts the inscriptions that have it. A sequence found in many inscriptions is a formula; one found in few is rare.
- The score of an inscription is the sum, over the sequences it shares, of ln(N / (1 + n)), where N is the number of inscriptions in the corpus and n the number that have the sequence. This is the inverse document frequency of information retrieval. A rare sequence adds much; a formula found everywhere adds almost nothing.
- An inscription that shares at least 50% of the sequences is marked as probably the same text: another edition, or a copy. The inscription must have at least 3 sequences for this mark.
- The answer lists the inscriptions with the highest scores (15 unless you ask for more, at most 50). For each, it joins the shared sequences into stretches of the text and shows the longest first.
How to read the score
- There is no fixed level that means “parallel” or “copy”. Compare the scores within one list.
- The score is a sum, so it grows with the number of shared sequences. A long inscription can share many formulae with another long one and get a high score with no rare sequence at all. The answer shows the shared stretches: read them.
- A short inscription has few sequences, so its parallels have low scores, and one rare sequence can decide the order.
- A shared sequence is not proof of a link. The same formula stands in many texts that have no other link. Read both texts.
Why on_stone is the default: editors often restore a gap from the formula of another text. With restored words, a parallel can rest on the editor's restoration, not on the stone.
Region, site, publication and date limit the inscriptions it compares. Then the count n also covers only those inscriptions, so a sequence can look rarer than it is in the whole corpus.
Example (2026-10-21): IG II² 1 (PH2219), the honours for the Samians, has 394 sequences of 3 words on the stone. 2,158 inscriptions share at least one. First is IG I³ 127 (PH130), with 259 shared sequences, marked as the same text: it prints the first decree of the same stone. Next come Attic decrees that share the formula ἔδοξεν τῆι βουλῆι καὶ τῶι δήμωι, with scores of 110 and lower.
The lookup tools
- get_inscription finds a text by its PHI number, or by publication and item number (
IG I³ 10, SEG 30.554). If the corpus files the text under another publication, the server also looks for the reference in the editions that the texts name in their bibliography: about 119,000 editions and 39,000 other places of publication. So I.Smyrna 442a finds the text that the corpus files under McCabe's number, Smyrna 819. Case, spaces and punctuation do not count, and a reference finds each text whose edition begins with it (I.Smyrna 442 finds 442a and 442b). It gives 200 lines unless you ask for more, and at most 1,000.
- get_inscriptions opens up to 20 texts in one call, with the first 5 lines of each (at most 30).
- list_inscriptions counts and lists inscriptions by place, publication, date and the editor's note, with no text search. The note filter keeps a text only if its note has every word you give, in any case. A word also matches inside a longer word:
epitaph finds “epitaphs”. Most texts have no note, so the answer says how many in the selection have one.
- list_regions and list_publications read the corpus's own names of regions, sites and publications, with their counts.
Example (2026-10-21): note="epitaph" finds 17,364 inscriptions. Only 63,770 of the 230,078 inscriptions have a note. Attica has only 283, because the older IG volumes, which hold most Attic texts, have no notes.
Published methods
- Spärck Jones, K. 1972. “A Statistical Interpretation of Term Specificity and Its Application in Retrieval.” Journal of Documentation 28 (1): 11–21. The weight of a rare sequence in find_parallels.
Questions about a method: [email protected].