A small C++23 library that takes a Latin word and returns the readings William Whitaker's WORDS gives it, with its stem, meaning, part of speech and inflection, add-ons and Roman numerals included. Includes C and Python bindings, both generated from the C++ header.
- Matches WORDS within what it implements. I compared 4.66 million lookups across 102 Latin books against my patched build of William Whitaker's Ada WORDS, down to the grammar of each reading and the order it came back in. Every difference was either a guess I've intentionally left out of the core library or one of three occurrences where WORDS dropped its answer and whitakerLib returned readings. See the comparison.
- Under a microsecond per word, on average over the same books.
- 1,205,496 spellings, 2,374,470 readings in a 3.8 MB image embedded in the library, with no external data file at runtime, no database and no dictionary to load.
- Try it in your browser, in the inspector.
- Install the Firefox extension, an offline Latin dictionary.
I started by trying to read Latin the way Whitaker did. Now I want to find the places where the readings can be better. If a word looks wrong or a reading is missing, open an issue or a pull request. Tell me which word it is. A link to the passage or a photo of the page is enough.
whitakerLib started as my own training project. I made it public because I couldn't find anything that worked like this, with fast lookups, no dependencies, low memory usage and a compact API.
It isn't meant as an easy tool for translating Latin, but as the backend for other things, such as running it on a Kindle or another low-resource device.
I'm no Latin expert. I come at this mostly from the programming side, and I don't think I've figured out anything new. What I have found is that Whitaker built something that really works. The more I've worked with WORDS, the more I've come to appreciate how he approached Latin, and his data is genuinely nice to work with.
While building whitakerLib, I found and fixed 19 bugs in Ada WORDS. I sent some of those fixes upstream, and several were merged. My comparison uses my own build with all 19 fixes. They change edge cases: readings WORDS lost, repeated or got wrong, and two crashes, on unietvicensimae in Tacitus and decimestres in Ammianus, that stopped it before the end of those books. See the fixes.
I have a much longer list to work through. I wanted to finish matching WORDS' readings first so I'd have a baseline for the changes I want to make. Bugs found in WORDS.
I've left macron handling and WORDS' guesses, including guesses at malformed Roman numerals, out of the core library. I'd like to add separate helpers for them over time.
Most Latin tools won't need lookups this quick and the generator could have been
written without reflection, but both were fun to build. The reasons why are
given in "Why reflection?" in codegen/README.md.
- Kindle and other e-readers: whitakerLib-kindle, a KOReader plugin: tap a word in your book to see its readings, offline.
- Firefox: whitakerLib-firefox, an extension on addons.mozilla.org: double-click a Latin word on a page to see its readings, offline.
I made these two to try the library in two quite different places: a desktop browser, as WebAssembly, and a Kindle from 2015. If it runs well in both, I figure it should work in plenty of other places too.
I want to keep updating these two, mostly to find where the library is awkward to use or needs too much boilerplate. The plan is to move parts of both plugins into the library over time, so it does those things itself instead of each plugin working around it. The grammar names introduced in 0.4.1 are the first example.
The first three words of the Aeneid. This is how the library reads them.
- arma is "arms, weapons", as nominative, vocative or accusative plural, or the imperative of armo, "arm!"
- virumque loses the tackon -que, "and", leaving virum, read as vir, "man, hero", alongside virus and the old genitive plural of vis, "strength".
- cano is "I sing", but also the dative or ablative of canus, "gray hair, old age", of canum, "wicker basket", and of the adjective canus, "white, hoary".
So as far as single words go, Virgil might be singing of arms and the man, or telling you to arm the man for the wicker basket. Or for old age. Or for the white one. cano won't say which. The library gives you all of them.
Choosing between them is left to whatever sits on top. My approach has been to make getting the readings so fast that a reader, a ranker or a parser can work with all of them, and with everything else the library gives.
From WORDS' files to a reading, in five steps.
codegenreads WORDS' four files: DICTLINE, INFLECTS, UNIQUES and ADDONS.- It expands every stem with every ending it takes, into the readings WORDS would give.
- It packs them into the image, and checks the image's lookup against the expansion on every spelling.
- At run time,
analyze()looks each word up in the image, and runs WORDS' passes (add-ons, syncope, respellings) for what the image alone can't answer. detail()decodes a reading only when you ask for it.
The browser reader shows step 4 at work. Paste some Latin or fetch a book, then click a word to see its readings. Open Trace to see the lookup passes in order and what each found. The reader runs as WebAssembly on the page. Fetching a new book needs an internet connection. Open the browser reader.
So to explain it, let me do it through a story: the story of Simplicissimus, a rather ambitious name, meaning "the simplest" or "most simple".
He arrives at the dictionary, where he is not recognized. Undeterred, he tries the next part of the program, which checks whether he might be a Roman numeral. No luck. Then come alternative prefixes, shortened verb forms, and attached particles. None can make sense of him. Five attempts, and still nothing.
But his journey isn't over. Eventually he arrives at the machinery for prefixes and suffixes, and there, at last, somebody recognizes him. The inspector's lookup trace records the encounter:
Dictionary +0 readings
RomanNumeral +0 readings
PrefixVariants +0 readings
Syncope +0 readings
Enclitic +0 readings
DictionaryWithAffixes +1 readings
The answer is an adjective derived from simplex, "simple, plain, unaffected". The program has recognized a superlative, formed using the suffix -issi-: Simplicissi|mus, nominative singular masculine, superlative.
What was missing from the ordinary dictionary search was not the underlying adjective, but the additional relationship needed to construct its superlative. Whitaker's program has an entire collection of these relationships: prefixes, suffixes, and other additions that can produce forms beyond the ordinary stem-and-ending combinations.
And so our simplest adventurer turns out to have required quite a complicated journey. Enter simplicissimus in Trace and follow it yourself.
How much to pack into the image and how much to leave to run time has been one of the most fun parts of this project. Moving even a small part of the work into the image can make it explode in size, so it's a matter of finding a good middle ground. In one experiment I tried with every finished spelling in the image, enclitics included, it grew to about 93 MB. With prefixes and suffixes added it passed 1 GB before it was even a tenth done, so those stay at run time.
codegen/README.md describes steps 1 to 3, and src/whitaker.cpp is where
step 4 starts, with WORDS' passes in WORDS' order.
The project is pre-1.0 and its ABI is not frozen. Until 0.5.0, existing C++
calls and fields won't be removed or changed, but new ones may be added.
0.4.1 is an exception. The grammar values were renamed (Case::NOM is now
Case::nominative), but kept their numbers.
include/whitaker.hpp is C++23, and it opens with what every call promises.
whitaker::Result result;
if (whitaker::analyze(result, "amoque") != whitaker::Status::ok)
return 1;
const whitaker::WordId word{0};
for (std::size_t r = 0; r < whitaker::readingCount(result, word); ++r) {
const whitaker::ReadingDetail detail = whitaker::detail(result, word, r);
// detail.dictionaryWord, detail.meaning, detail.form.grammar, detail.form.stemSpelling, ...
}The data is plain data and the functions are free functions. Result is the one
owner, holding a batch's words and readings, and everything else reads it.
analyze()replaces the result, andappend()adds one word. Unknown words returnokwith no readings, words longer than 24 bytes returninputTooLong, and when memory runs out,outOfMemory.clear()keeps the capacity.- A word is a
WordId, its place in the result.spelling(),trimmed(),readings()andreadingCount()take one, and past the last word they give the empty value. - A reading is stored as 8 bytes of plain data (
latin::packed::Reading, whatreadings()gives), plus a change record for a reading that has one (syncope, add-ons, a respelling).detail(result, word, readingIndex)decodes one only when you ask, into aReadingDetail(160 bytes today): itsdictionaryWord(what the dictionary says of the word, which no ending changes), itsform(stem, ending and grammar), and its meaning and add-ons. stems()gives the dictionary word's stems, anddictionaryForm()gives its dictionary form as WORDS prints it (amo, amare, amavi, amatus V (1st)), or an empty one where WORDS gives none (a Roman numeral, qui).rows(result)is the whole batch as a table, one row per reading, and one for a word with none, a standard view over the result.- What a call lends goes stale on the next
analyze,appendorclear, and strings returned asconst char*belong to the library. Different results run on different threads in parallel. A thread's first lookup sets aside about 120 KB for its own use, and if that can't be allocated the program currently stops, as it would if the C++ runtime couldn't start the thread.
Grammar values are named in the reader's words (Case::nominative), and
label() gives one as text ("future perfect"). The generated
<latin_generated.hpp> companion gives Latin names and grammar descriptions,
and addonSpelling(), addonMeaning() and spellingRule() describe the ids a
reading carries.
Both are generated from the C++ header's WHITAKER_TAG(bind) tags by codegen,
with the same fields by the same names, and gen's build stops while either is
out of date with the header. For now, the inspector is the place to see them.
Its API view shows every call and every field of a reading as C++, C or Python.
Unlike the C++ API, the bindings may still change before 0.5.0. There is no
WebAssembly binding yet, since the inspector builds the library to WebAssembly
for itself.
- One word per call, with no tokenizing, parsing, ranking or translation.
- ASCII only. Case-insensitive, and
jfolds withiandvwithu, except in Roman numerals and, as in WORDS, in the syncope pass. Long marks and ligatures are left to the caller. - WORDS' word-split and bad Roman numeral guesses are not implemented.
Both were measured over the same 102 Latin books. The speed run used an earlier copy of the texts, 4,662,505 word occurrences; the comparison uses the current one, 4,663,396.
Speed. On one thread, the C++ example (examples/cpp) analyzes the
4,662,505 words, then decodes and describes every one of their 17,460,251
readings, in 3.53 s, or 0.76 µs a word. On the CPU's 12 threads it takes 0.49 s.
Reading the files and splitting them into words is not timed. Finding a word's
readings alone, without decoding them, takes 421 ns a word natively and 610 ns
in WebAssembly under Node. Ryzen 5 5600X, GCC 16, a Release build.
On a Kindle. The library runs on a Kindle Paperwhite 3 from 2015 (Cortex-A9,
about 1 GHz), cross-compiled with Clang as a Release build targeted at its CPU
(-O3 -mcpu=cortex-a9 -mfpu=neon), with no other tuning. On 200,000 words
evenly spaced through the books, it looks up each word and decodes every reading
in 2.56 s on one thread, 12.8 µs a word. The lookup alone takes 8.8 µs. It
returns the same 750,215 readings as the PC. The KOReader plugin runs on it
there (see Built with whitakerLib).
Accuracy. Every word is compared with the answer from the Ada WORDS program, built using the same data, down to each reading with its stem, each dictionary record and meaning, the add-ons, and the order of all of them.
Across 102 books, every difference from my patched Ada WORDS is explained. The raw comparison gives 99.58% exact agreement across all 4,663,396 word occurrences. The differences are 19,665 guesses that whitakerLib leaves out of the core library and three occurrences of pilula and seconda, where WORDS drops its answer when its parse arrays fill and whitakerLib returns readings.
The oracle report breaks down the comparison
against patched WORDS revision 5dd8ca5. The book list
has the per-book results from 0.4.0.
Tracking down where the two disagree turned up several bugs in WORDS itself, some of which crashed it.
Tested on Linux only. It needs CMake 3.21, GCC 15 or Clang 20 (for #embed
in C++, with its offset parameter). Callers use C++23 and whitaker.hpp, or C11
and whitaker.h.
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
cmake --install build --prefix /your/prefixThe options are WHITAKER_SANITIZE (ASan and UBSan), WHITAKER_BUILD_PYTHON (needs
pybind11), and WHITAKER_INSTALL and WHITAKER_WERROR, which are on when
whitakerLib is the top-level project and off under add_subdirectory().
The install provides a CMake package and a relocatable whitaker.pc.
find_package(Whitaker CONFIG REQUIRED)
target_link_libraries(your_target PRIVATE Whitaker::whitaker)bindings/c and bindings/python are generated from the header, and
inspector/ is built with Emscripten (emcmake cmake). examples/cpp reads on
several threads and compares them with one thread, and examples/c prints every
reading of the words given.
Words. If a reading looks wrong or a reading is missing, open an issue or a pull request. Tell me which word it is. A link to the passage or a photo of the page is enough.
Code. Anything that makes it faster or smaller is welcome, as long as I can understand it. I'm not strict on style either. If you know a cool trick, show me. How you got there doesn't matter, AI included, as long as you understand the change you're sending.
The data is from Colonel William Whitaker's WORDS, revision 1f2f0fb0867a
(2026-08-26) of
mk270/whitakers-words, the files
DICTLINE.GEN, INFLECTS.LAT, UNIQUES.LAT and ADDONS.LAT, unmodified.
They are not shipped. data/source/MANIFEST.sha256 holds their hashes and
codegen/README.md says how to fetch them, which only regenerating the image needs.
data/whitaker.dat, the image, is checked in, so a build cannot change it
silently. codegen/README.md says how it is made and checked.
The library is under the European Union Public Licence v. 1.2 (LICENSE).
The WORDS data is a separate work under Whitaker's notice
(data/source/LICENCE.txt).
A big thanks to William Whitaker for making his program available. Not all of it has aged like fine wine, but I think the systems underneath it make sense for Latin.
And an equally big thanks to mk270 for keeping it well maintained, and for making sure a program of that age still moves forward. Writing a program is one thing. Understanding someone else's well enough to carry it forward, with respect for what they built, is another, and it doesn't get the credit it deserves.

