Skip to content

daniel-persigehl/verba

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

verba — a command-line Latin lexicon & parser

A self-contained CLI for looking up Latin, in the spirit of Whitaker’s WORDS, built over freely-licensed dictionaries (mostly public domain; Lewis & Short is CC BY-SA — see ATTRIBUTION.md).

Install

Requirements: Python 3.8+ and nothing else — the CLI is pure standard library, no pip install, no virtualenv. Runs on Linux, macOS and Windows (any CPU; on a legacy Windows cmd.exe colour falls back off, or set NO_COLOR). The dictionary data is included and prebuilt, so there is nothing to compile or download:

git clone <this repo> && cd verba
python3 verba.py lat virtus      # ready to use immediately

(./verba.py on Unix after chmod +x verba.py; python verba.py where Python is called python.)

Usage

Run verba with no arguments and it opens an interactive session (the default when you’re at a terminal). Give it a query and it runs that one lookup and exits:

python3 verba.py                  # interactive session (the usual way to browse)
python3 verba.py parse amavit     # head-form + morphology + Whitaker + L&S gloss
python3 verba.py lat   virtus     # Latin -> English, full L&S article (--full = examples)
python3 verba.py ww    virtus     # Latin -> English, terse one-liner (Whitaker meanings)
python3 verba.py eng   courage    # English -> Latin (Smith & Hall 1871)
python3 verba.py syn   accurate   # Ogilvie's synonym/syntax note (Horae Latinae)
python3 verba.py morgan robot     # opens neolatinlexicon.org (consult-only link)
python3 verba.py abbr             # legend of the abbreviations in output (v. n., Trop., …)
python3 verba.py lat rex -i       # run the lookup, then stay in the session
python3 verba.py repl ww          # session starting in a given mode

parse and ww take -n N (max results); lat=/=eng=/=syn take -n and --full (show example quotes); any query command takes -i=/–stay=. --full is also global — it works before the command and on the bare session (verba --full, verba --full lat amor), not only after it.

A query on the command line always runs once and exits, so verba stays composable — pipe it (verba lat fero | less) or call it from a script or Emacs shell-command without it dropping into a prompt. (When output isn’t a terminal the session never starts, so a pipe can’t hang.)

In the session: a bare word looks up in the current mode; a bare mode name lat ww parse eng syn switches mode; lat rex runs a one-off in another mode (current mode unchanged); add --full to a query for the full text, or :full to toggle it on for every lookup; :help, :q (Ctrl-D). The engine loads once (instant after the first lookup), and output flows straight to the terminal (no pager), so the whole session stays in your scrollback.

What it does

  • parse — full morphological analysis: reconstructs the dictionary head-form (amavit -> amo), lists every parse (case/number or tense/voice/mood/person), gives Whitaker’s terse meaning, and appends a condensed Lewis & Short gloss.
  • lat — the full Lewis & Short article (Latin->English), condensed by default (senses + glosses + attesting authors, no citation text) so it never floods the terminal; --full shows the Latin examples. (The main word lookup.)
  • ww — quick Latin->English: Whitaker’s terse one-liner per lemma. Named ww (Whitaker’s WORDS) on purpose — not a word in either language, so as a session mode name it can’t be confused with a headword you’re looking up.
  • eng — English->Latin from Smith & Hall (1871), rendered in the same structured style as lat: the Latin equivalents (the “answers”) stand out, each with its principal parts, under the English meaning-divisions; in the example phrases the Latin is highlighted, with dimmed citations and v. cross-references. --full shows every phrase. Also flags an Ogilvie note when one exists for the headword.
  • syn — the full article from Ogilvie’s Horae Latinae (1901): how to choose between near-synonyms and the syntax of an English notion. ~477 articles, keyed by English head-word; condensed by default, --full for the whole.

Results are frequency-ranked (commonest reading first); v/u and i/j fold, so uirtus finds virtus.

Coverage

Regular nouns/adjectives/verbs, indeclinables, the enclitics -que/-ne/-ve (armaque, estne), participles (VPAR: amatus, amandus, futurus), and the irregulars — esse and its paradigm (est, sunt, eram, fui, sim…; the base verb is injected since Whitaker keeps it out of DICTLINE), posse/eo ferre/velle/fieri/, and the gap-forms in UNIQUES.LAT (vult, mavult…). Not yet: a few rare syncopated forms; full principal-part display.

Data & sources

Four public-domain (or freely-licensed) lexica, regularized into one schema. Lewis & Short is CC BY-SA (the Perseus TEI edition), so the L&S-derived data carries a ShareAlike + attribution obligation; everything else is public domain. Full per-source provenance, licenses and required attribution are in ATTRIBUTION.md:

  • Whitaker’s WORDS (DICTLINE.GEN, INFLECTS.LAT, UNIQUES.LAT) — morphology + terse meanings. Public domain.
  • Lewis & Short (1879), via the Perseus Digital Library TEI (ls_schema.jsonl). CC BY-SA 4.0, attribution to Perseus. Drives lat and parse’s inline gloss.
  • Smith & Hall, English-Latin Dictionary (1871) (smithhall_schema.jsonl). Public domain. Drives eng.
  • Ogilvie, Horae Latinae (1901) (horae_latinae.jsonl). Public domain. Drives syn.

The data here is shipped prebuilt. The build tooling (which regularizes each source into the schema) lives in the project’s development repository.

Not folded in: Morgan

The Morgan-Owens Neo-Latin Lexicon (neolatinlexicon.org) is CC BY-NC-ND, so its data is never bundled; verba morgan <word> only deep-links to the entry on their site (or its search page) to consult a term there.

About

A command-line Latin lexicon & parser over public-domain dictionaries (Whitaker's WORDS, Lewis & Short, Smith & Hall, Ogilvie's Horae Latinae). Pure Python, no dependencies.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages