Skip to content
Published on

Lookup Cost Decides What You Can Read — From Two-Thousand-Year-Old Texts to Code Navigation

Share
Authors

A text that needs two hundred dictionary lookups cannot be read

Anyone who has studied a classical language knows this feeling. You roughly know the grammar and you have accumulated a fair amount of vocabulary, and yet one page of the original takes two hours. The reason is not that it is difficult. It is that you keep getting interrupted.

One word stops you. It is inflected, so it does not appear in the dictionary in that form, and you first have to guess the lemma. If the guess is right you open the dictionary, and if the entry is long you pick out of it the sense that fits this context. Say that took thirty seconds. Then you come back to the sentence and you have forgotten its first half. You read it again.

When that happens two hundred times on one page, the sum stops being a matter of time. Because working memory is reset every single time, sentences do not assemble into sentences. At that point the text is not a difficult text; it is a text that cannot be read.

What Ancient Library does

Ancient Library is a site that removes exactly this one problem. It gathers Greek and Latin originals, and when you click any word inside the text, it shows you the lemma, the morphological parsing, and the whole dictionary entry right there.

The scale is stated on the site itself. There are 1,060 works, of which 293 are Latin and 767 are Greek, by 140 authors. They are organized into 14 Latin and 16 Greek genre categories.

The dictionaries are the two standards of classical scholarship. For Latin it is the 1879 Latin dictionary of Lewis and Short; for Greek it is the 1940 ninth edition of the Liddell-Scott-Jones Greek-English lexicon. The site describes itself as a public-benefit project of Worth Media.

Where the pieces came from is half of it

The part easiest to miss when looking at this site is provenance. The texts came from the Perseus Digital Library at Tufts University and are provided under Creative Commons Attribution-ShareAlike 4.0. Both dictionaries were digitized by Perseus as well.

That is to say, what this site newly made is neither the texts nor the dictionaries. It connected resources that had been public for decades into one screen, one click away.

There is something this structure implies. Tools that remove lookup cost usually do not create new data. They shorten the distance between data that already exists. And that distance is nearly the entire cost. The dictionaries existed a hundred years ago and the texts have existed for two thousand years. What did not exist was the 0.2-second path between the two.

The choice to automate morphological parsing, and its price

Lemmas and morphological parsing are not a quantity of work a person can attach by hand. The site states that it handed that work to language models trained on the classical languages. It is written that odyCy was used for Ancient Greek and LatinCy for Latin.

And the site itself spells out the price of that choice: automatic parsing is not perfect, and rare forms may get the wrong lemma or the wrong analysis attached.

I think that one sentence is the most important part of this site, because failures of automatic parsing are silent. A wrong analysis does not raise a question mark; it shows a plausible case and number. A beginner cannot notice that it is wrong, and the person who could notice needed the tool less to begin with. The structure is that the user who gains most from the tool is the most vulnerable to its errors. Whether the site writes this down up front or does not leaves the user in a completely different situation.

What changes when lookup cost reaches zero

Cost going down and cost going to zero are different things. What changes here is not speed but the kind of work that is possible.

When a dictionary lookup takes thirty seconds, we look up only the words that truly block us. Words that are ambiguous but can be waved past get waved past. But when a lookup takes 0.2 seconds we check the ambiguous ones too, and while checking we find out where we had been wrong. That is, when the cost disappears, the way of reading itself changes.

The second change is flow. As we saw above, the real loss was not the thirty seconds but the first half of the sentence lost during those thirty seconds. When the answer appears inside the same screen the flow is not broken, and then a long sentence stays a long sentence.

The third is a little less obvious and is the biggest one in practice. When lookups get cheap, the habit of moving on without checking shrinks. Faced with an expensive lookup, what we actually do is not verify but guess, and because guesses are mostly right there is no occasion to learn that we were wrong. A misunderstanding hardened that way surfaces months later in a completely different place. A good share of the benefit a cost-removing tool gives lies right here, in preventing a wrong belief from setting.

The same story we already know

If this structure feels familiar, that is correct. We have already been through the same thing in code.

Think back to reading code in the days before jumping from an identifier to its definition. To see a function name and find where it lived, you had to dig through the file tree or run a full-text search. Doing that lost the place you had been reading. So we looked up only what truly blocked us and guessed the rest from names.

Once go-to-definition worked instantly, the way we read code changed. Instead of skimming an unfamiliar codebase from top to bottom, we could grab one thing and keep drilling into it. That we can now sketch a rough map of a repository we have never seen before in a single day is not because we got smarter. It is because lookups became free.

The new failure mode that comes with it

The same benefit brings the same price. Code navigation tools also fail quietly.

In dynamic languages, go-to-definition picks one candidate when there are several. Even when that pick is wrong, the editor does not raise a question mark; it opens some file. If the opened file looks plausible we accept it as the answer and stack judgments on top of it. It goes wrong especially often when there are several interfaces and implementations, when monkey patching is involved, or when generated code is mixed in.

One practical conclusion comes out of this. A tool that leans on automatic analysis has to show the user that it can be wrong. Just as Ancient Library wrote its limits into its documentation, an editor navigation feature should not hide the fact that there were several candidates. Picking one and quietly opening it is comfortable, but the comfort is paid for by finding out late when it was wrong.

Something to try this week

If you move this perspective onto your team, the question to ask is not which tool to use but what is still an expensive lookup in our codebase. Usually it is one of the following four.

  • Where this config value actually gets read. If it is accessed by a string key, go-to-definition does not reach it.
  • Which code produces this API response field. Navigation breaks at a service boundary.
  • Where this error message comes from. If the string is assembled, search does not find it.
  • Who uses this table column. If the ORM transforms names, the link is invisible.

What the four have in common is that they are the spots where automatic navigation breaks. Count what your teammates asked about in Slack over one week and the list appears. Make searchable forms for just the top two of them — turn string keys into constants, gather assembled messages into one place — and that single change removes hundreds of lookups from here on.

Summary and sources

What a tool does is not to create knowledge that did not exist. It is to shorten the distance between things that already do. But when that distance shrinks, the kind of work we can do changes, and so a tool often looks like a question of ability.

  • Ancient Library — the number of works and their distribution by language, the information provided on a click, the editions of the two dictionaries
  • Ancient Library about page — that the texts came from the Perseus Digital Library, the Creative Commons Attribution-ShareAlike 4.0 terms, that odyCy and LatinCy were used for morphological parsing, and the explicit limit that automatic parsing is not perfect
  • The code navigation discussion in the second half is not something those sources cover; it is my own transfer of the same logic to development work.