Skip to main content

Download and parse ORACC cuneiform text projects into ML-ready formats

Project description

oracc-parser

A Python tool to download and parse ORACC cuneiform text projects into machine-learning-ready formats (JSONL, CSV, pandas DataFrames).

Features

  • Download — Fetch project ZIPs from preprocessed files on Zenodo or directly from ORACC
  • Parse — Convert raw ORACC JSON / preprocessed CSVs into structured data and create machine-learning-ready text representations (in transliteration, normalization, lemmatization, or Unicode cuneiform)
  • Configure — Control handling of broken signs and POS masking
  • Export — Save datasets as JSONL, CSV, or pandas DataFrames

How to Cite

If you use oracc-parser in your research, please cite:

@software{romach_oracc_parser_2026,
  author       = {Romach, Avital and Spencer, Shahar and Gordin, Shai},
  title        = {oracc-parser: A Python toolkit for downloading and parsing ORACC cuneiform text projects},
  year         = {2026},
  publisher    = {Zenodo},
  version      = {0.1.5},
  doi          = {10.5281/zenodo.18643122},
  url          = {https://doi.org/10.5281/zenodo.18643122}
}

Installation

pip install oracc-parser

Or for development:

git clone https://github.com/shaharspencer/oracc-parser.git
cd oracc-parser
pip install -e ".[dev]"

Getting Started — Notebooks

The easiest way to explore oracc-parser is through the interactive notebooks, that go through the main functions.

Notebook What you'll learn Open in Colab
01_quickstart.ipynb Download the dataset → parse a project → explore transliterations, translations, and metadata → export Open In Colab
02_configurations.ipynb RunConfig options — word-level and sign-level break filtering, POS masking, combining multiple projects and exporting datasets Open In Colab
03_translations.ipynb Where translations come from, how to download the translation cache from Zenodo, and how to enable translations in the parsing pipeline Open In Colab
04_reference_data.ipynb Browse all projects in the dataset, query catalogues, explore bundled reference data (provenance, periods, sign list, POS tags) Open In Colab
05_oracc_json_processing.ipynb Advanced: understand the raw ORACC JSON structure, the JSON → TabletRecord → CSV pipeline, and how to download and parse projects not in the dataset Open In Colab
pip install oracc-parser[notebooks]
jupyter notebook notebooks/

Quick Example

from oracc_parser.download.fetch_data import fetch_data
from oracc_parser import parse_project, RunConfig, get_full_flat_table

# Step 1: download catalogues from Zenodo (run once)
fetch_data()

# Step 2: parse a project — word CSVs fetched from Zenodo on first call,
# read from disk on subsequent calls
records = parse_project("saao/saa01", config=RunConfig(limit=5))

# Get a flat DataFrame — no nesting, ready for analysis
df = get_full_flat_table(records)
df.to_json("dataset.jsonl", orient="records", lines=True)

# For a project not on Zenodo, download directly from ORACC servers:
records = parse_project("my/project", download_from_oracc_server=True)

Configuration

You can customize the parsing process using RunConfig:

from oracc_parser import parse_project, RunConfig

records = parse_project("saao/saa01", config=RunConfig(
    limit=10,
    max_break_fraction=0.5,   # word-level: drop words that are >50% broken
    drop_missing=True,        # sign-level: drop [x] signs from Unicode output
    drop_damaged=False,       # sign-level: keep ⸢x⸣ signs in Unicode output
    mask_pos=["PN", "DN"],    # replace personal/divine names with tag
))

Two independent levels of break filtering

RunConfig provides two distinct ways to handle damaged or missing text, operating at different granularities and affecting different outputs:

Parameter Level Affects How it works
max_break_fraction Word Transliteration, normalization, lemmatization Each word has a break_perc (fraction of its signs that are broken). Words exceeding this threshold are replaced with X. Default 1.0 keeps all words.
drop_missing Sign Unicode cuneiform only Drops individual signs marked [x] (completely lost).
drop_damaged Sign Unicode cuneiform only Drops individual signs marked ⸢x⸣ (partially legible).

Note: Because word-level and sign-level filtering use different thresholds and different granularities, the text outputs and the Unicode cuneiform output are not aligned. A word kept in the transliteration (because its average damage is below max_break_fraction) may still have individual signs dropped from the Unicode output if drop_missing / drop_damaged are enabled. None of these filters affect the translations.

Other options

Parameter Default Description
limit None Only parse the first N texts (useful for testing)
keep_word_segmentation True Preserve word boundaries in Unicode cuneiform output
mask_pos [] Replace words of certain POS tags with the tag name

All reference data is bundled with the package, so you don't need to configure external paths unless you are customizing oracc_parser.settings.

CLI

oracc-parser download --project saao/saa01
oracc-parser parse --project saao/saa01 --limit 5 --format jsonl --output saa01.jsonl

Heavy Data (Zenodo)

Large data files (ORACC ZIPs, word-level CSVs, cached translations, Pleiades data) are on Zenodo:

DOI

python scripts/download_zenodo_data.py

Running Tests

pytest tests/ -v     # 98 tests

License

MIT — see LICENSE.

Credits

Based on code by Niek Veldhuis (Compass) and adapted for the BEn Project.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oracc_parser-0.1.5.tar.gz (134.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oracc_parser-0.1.5-py3-none-any.whl (140.4 kB view details)

Uploaded Python 3

File details

Details for the file oracc_parser-0.1.5.tar.gz.

File metadata

  • Download URL: oracc_parser-0.1.5.tar.gz
  • Upload date:
  • Size: 134.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for oracc_parser-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8af0fa9568f78411cd203055aac081c9bfbf21912567402188fb8735d9d930df
MD5 b81caccc675f4c7c9d2a7d6a031a1bfc
BLAKE2b-256 4c9224381a66f934309dfa31714b5810c055e1a22889568fc74bc1034b2e81ea

See more details on using hashes here.

File details

Details for the file oracc_parser-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: oracc_parser-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 140.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for oracc_parser-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9b6cfdc909797fd05b1dff77776d58a1d93d2dd7698a8619384342d722251e36
MD5 3afab3b8f9efafda3b0f188912bfef49
BLAKE2b-256 27fdf6a61e945be787252b17c17eae9401d6892d773bf5cdc23c5ea45e1b7d99

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page