This release is a pre-release and may not be stable for production use.
ikelos
Pure-Python port of the Ancient Greek side of
Morpheus, the Perseus morphological
analyzer. It installs as a py3-none-any wheel with the Greek stem library
bundled, so it needs no C compiler. It was built to run inside
greCy spaCy pipelines. Licensed MPL-2.0,
like Morpheus.
pip install ikelos
Status: alpha. The whole Greek runtime path of cruncher is ported
(about 317 C functions, found by tools/callgraph.py). It reproduces the C
output on the test fixtures and on the UD-derived golden corpus (see
tests/test_parity.py).
>>> import ikelos
>>> ikelos.lemmatize("λόγους")
['λόγος', 'λογόω']
>>> a = ikelos.analyze("ἀνθρώπου")[0]
>>> a.lemma, a.pos, a.features
('ἄνθρωπος', 'noun', {'gender': 'masc', 'case': 'gen', 'number': 'sg'})
ikelos [-S] [-n] reads Beta Code words on stdin and prints the same
Perseus-format output as cruncher.
Layout
| Path | What |
|---|---|
ikelos/betacode.py |
Morpheus Beta Code ↔ NFC Unicode (quantity marks, ʼ apostrophe) |
ikelos/stemlib.py |
Lazy loaders plus exact emulations of the C lookups (binlook, ChckPreIndex, ChckFullIndex, checkendind, morphstrcmp) |
ikelos/greeklib.py |
src/greeklib (accents, breathings, syllables, quantity) and the greek.h macros |
ikelos/gkstring.py |
gk_string / gk_word types, morph flags, dialect logic |
ikelos/morphkeys.py |
Key vocabulary and ScanAsciiKeys |
ikelos/morphlib.py |
Augment, preverbs, accentuation (FixPersAcc/FixRecAcc), euphony tables |
ikelos/gkends.py, gkdict.py |
Ending retrieval (chckendings, WantGkEnd) and stem/derivation lookups |
ikelos/analyzer.py |
src/anal/check*.c plus the generator src/gener/genwd.c |
ikelos/cli.py, api.py |
cruncher emulation (Perseus output) and the Python API |
ikelos/consts.py, keytables.py |
Generated from the C headers by tools/gen_tables.py |
ikelos/data/greek/ |
Generated data (do not edit by hand) |
tools/export_data.py |
Regenerates data/greek from $MORPHEUS_HOME/stemlib/Greek |
tools/dump_endtables.c |
Dev-only decoder for the binary *.out endtables, built with the real C reader |
tools/make_golden.py |
Runs the C cruncher over UD treebank forms to produce tests/golden/ |
tools/build_clib.sh |
Builds the C libraries as a shared library for the ctypes differential tests (tests/test_c_*.py, tests/clib.py) |
tools/parity_report.py |
Golden-corpus pass rate and a JSONL list of mismatches |
tools/callgraph.py |
Lists the C functions reachable from cruncher's main |
Development
Only the dev tools and the parity tests need the C original. Check it out next
to this repo, or point MORPHEUS_HOME at a checkout:
git clone https://github.com/perseids-tools/morpheus ../morpheus
(cd ../morpheus/src && CFLAGS='-std=gnu89 -fcommon -Wno-return-type -Wno-implicit-function-declaration -Wno-int-conversion -Wno-incompatible-pointer-types' make && make install)
python3 -m venv .venv && .venv/bin/pip install -e '.[test]'
tools/build_clib.sh # optional: enables the per-function C differential tests
.venv/bin/pytest -q # MORPHEUS_FULL_GOLDEN=1 checks the whole golden corpus
# when the C stemlib changes
.venv/bin/python tools/export_data.py
.venv/bin/python tools/gen_tables.py
.venv/bin/python tools/make_golden.py path/to/UD_Ancient_Greek-*/*.conllu
The fixture and golden tests (tests/fixtures/, tests/golden/) are
self-contained. Tests that need the compiled C library are skipped when it is
missing.
Notes for porters
- The binary endtables are decoded with the C reader and stored in file
order. Their order is not plain ASCII order, and
RetrCompEndsstops at the firstWantGkEnd < 0, so the order has to be preserved. - Noun stems are looked up through
nomind.lindex(a sparse pre-index followed by a linear scan). Verb stems, ending indices,lemlistandvbs.cmp.mluse the in-memory binary searchcheckendind. Much ofgkdict/dictio.cis dead code that sits after earlyreturns. - On macOS the C output order differs from Linux in some cases (2 of 94
fixtures), so parity is checked on analysis multisets. The Python sort is
stable, like glibc's
qsort, so the CLI matches the Linux order. - Functions are ported 1:1, C quirks included. A C function that writes into a
char *returns the new string, and a pointer into a word becomes an index. Struct copies (gk_word w = *g) arecopy(), and they share the analysis array the way the C structs share its pointer. - The key
illwappears twice inderivtypes.tablewith different values. C (macOSqsortplusbinlook) resolves it to the first one, so duplicate keys resolve to the first entry in the table.
Metadata
Release files for ikelos 0.1.0.dev1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ikelos-0.1.0.dev1.tar.gz | 1.6 MB | Without provenance | Details for ikelos-0.1.0.dev1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ikelos-0.1.0.dev1-py3-none-any.whl | Python 3 | none | any | Details for ikelos-0.1.0.dev1-py3-none-any.whl |
Total release size: 3.2 MB
Release files / ikelos-0.1.0.dev1.tar.gz
| Download URL | ikelos-0.1.0.dev1.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b2f8c99f4955ff8f86185739124903b3634be7124ffb34daa0cd48ee4055a9a9
|
|
BLAKE2b-256 checksum How to use checksums |
0c58bdfdf6a2b18af8a8e5579da0f0421d4a0f5ed11808a0aadc1a07c7790bef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Release files / ikelos-0.1.0.dev1-py3-none-any.whl
| Download URL | ikelos-0.1.0.dev1-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
908f58a9136538f9f65a13fdb858d8f86e9e542914195493d09cade60df31ae9
|
|
BLAKE2b-256 checksum How to use checksums |
1d7d2a6ec26873679369bd92701406f3de280e5b6319ab364fa945c16cf99a10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|
Security for ikelos 0.1.0.dev1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.