aegean.scripts.greek¶
greek ¶
Greek script plugin.
Registers Greek as a Script, its bundled sample corpus loader, its specialized
loaders (nt, ddbdp, patrologia), and every hosted JSON Greek corpus
declared in :mod:aegean.core.catalog. The script's nlp capability exposes
the aegean.greek pipeline.
Greek ¶
collection_works ¶
collection_works(collection_id: str | None = None, *, author: str | None = None, query: str | None = None, limit: int = 0) -> list[dict[str, Any]]
Search or list works across the 8 categorized Greek collections (100% offline).
Parameters¶
collection_id:
Optional collection filter (e.g. 'chrysostom', 'church-fathers-early',
'classical-greek', 'byzantine-lit').
author:
Optional author substring filter (case- and diacritic-insensitive, e.g.
'Chrysostom', 'Basilius', 'Anna Comnena').
query:
Optional multi-term search across work_id, author, title, and tlg.
limit:
Maximum results to return (0 returns all matches).
collections ¶
List metadata and install status for all 8 categorized Greek collections (offline).
load_collection ¶
load_collection(collection_id: str, *, work: str | None = None, author: str | None = None, offline: bool = False, force: bool = False) -> Any
Load a categorized Greek corpus collection, one author, or a single work.
Examples¶
load_collection("chrysostom", work="In Matthaeum") load_collection("church-fathers-early", author="Basilius") load_collection("byzantine-lit", work="Alexias")
load_collection_work ¶
load_collection_work(work_spec: str, *, collection_id: str | None = None, offline: bool = False, force: bool = False) -> Any
Resolve and load a single Greek work from any of the 8 collections.
resolve_collection_work ¶
Resolve an ogc... ID, TLG ID, or title/slug query to one catalogued work.
ddbdp_db ¶
The path to the fetched DDbDP SQLite database (fetched + unpacked on first use).
Pass it to aegean.db.search() / stream() / from_sqlite() for memory-friendly,
full-text-searchable access to the 57k papyri without materialising the whole corpus.
load_ddbdp ¶
Load ALL of DDbDP as an in-memory Corpus (opt-in, fetched, CC BY 3.0).
WARNING: 57,331 papyri / ~4.4M tokens — this materialises the entire corpus (minutes of
work) and costs several GB of RAM. For most work prefer the memory-friendly DB layer:
aegean.db.search(ddbdp_db(), ...) for instant full-text search, or
aegean.db.stream(ddbdp_db()) for flat-memory iteration. progress (optional) is
called as progress(done, total) per materialised document (see
aegean.db.from_sqlite), so a long load can show it is moving; the corpus is
identical with or without it. The attribution travels with the corpus provenance;
cite the DDbDP (papyri.info).
load_nt ¶
Load the Greek New Testament (Nestle 1904) as an annotated Corpus.
book selects one book by name or abbreviation ('John', 'Jn', '1Cor',
'Rev'); None returns the whole NT. ref selects within a book, mirroring
load_work: '3' a chapter, '3.16' a verse, '3.16-3.18' / '3.16-18' a
verse range, '3-5' a chapter range. One Document per chapter; every token carries
a gold lemma, Robinson morph, Strong's number, reconciled UD upos, and the
normalized form in Token.annotations. Token text, lemmas, and normalized forms are
NFC-normalized at load time (the source edition mixes oxia and tonos precomposition),
so gold strings compare byte-for-byte with the library's NFC output.
The full 27-book corpus is fetched to cache on first use (sha256-pinned CC0 asset, or
PYAEGEAN_NT_CORPUS_URL). When that asset is unavailable the bundled sample
(John 1 + Philemon) is used as an offline fallback (its provenance says so).
cite() names the canonical book and selected chapter/verse range before the
unchanged edition bibliography. Missing range endpoints raise ValueError instead
of silently truncating a passage while citing the requested, unavailable endpoint.
load_patrologia ¶
Load the Calfa–GREgORI Patrologia Graeca corpus (33 volumes, CC BY 4.0, OCR).
Pass volume (e.g. 'PG073', '73', 'PG123') to load a single volume
quickly, or omit volume to load all 33 volumes.
patrologia_volumes ¶
List metadata for all 33 CGPG Patrologia Graeca volumes (works offline).
load_work ¶
load_work(work: str, *, ref: str | None = None, source: str = 'auto', edition: str | None = None, force: bool = False, offline: bool = False, root: Path | None = None) -> 'Corpus'
Load one Greek work from Perseus canonical-greekLit / First1KGreek.
work is the CTS-style id ("tlg0012.tlg001" = the Iliad). source
is "perseus", "first1k", or "auto" (try both, in that order);
edition picks a specific edition file when a work has several. The TEI
file is fetched once into the cache (network on first use only).
ref selects a sub-section instead of the whole work — a citation address
matching the work's structure: a textpart number ("1" = Iliad book 1),
a nested div path ("1.2" = book 1, chapter 2 of a prose work), a verse
line-range ("1.1-1.50" = book 1, lines 1–50), a marginal <milestone>
marker outside the CTS <div> scheme (a Stephanus sub-page "17a", a Bekker
line "1447a10" — the span to the next marked line — or a whole Bekker page-column
"1447a", the physical page being the comma list "1447a,1447b"), or a comma list
of any of these ("1.1,1.5", "1,3", "17a,17b") giving one Document per entry. A
hyphen range must stay within a single textpart: "1.1-2.50" (crossing from book 1
into book 2) raises ValueError; use a comma list, or load each book separately and
Corpus.merge the results. Without ref, the corpus is one Document per
top-level textpart. The corpus provenance's citation is the canonical
scholarly citation of exactly what was selected ("Homer, Iliad 1.1-1.50"; see
canonical_citation), so corpus.cite() echoes the selection.
<note>/<bibl> ride along in Document.meta.notes. Raises
aegean.data.DataNotAvailableError when the work can't be found/fetched, or
ValueError when ref matches nothing — that message names the work's declared
citation scheme (cited by book.line); citation_scheme returns it directly.