Scripture Indexer automatically builds an index of biblical quotations from photographs or scans of Latin manuscripts, such as missals and lectionaries.
You point it at a set of page images (or a PDF), and it:
- transcribes the pages with the Kraken handwriting recognition engine,
- compares the transcription against a biblical text of your choice (the Sixto-Clementine Vulgate text is used as default),
- indentifies the biblical readings,
- writes a page-by-page index of biblical references, ready to read as a YAML file.
The transcription is cut into overlapping windows of consecutive words. Each window is compared to every verse of the biblical text using character n-gram similarity. A dynamic-programming optimizer then walks through the windows in order and selects the most plausible chain of verses: it rewards similarities, penalizes gaps and implausible jumps, and tries to group the verses into the longest possible sequence of readings. The retained readings are finally grouped per page and formatted as standard biblical references.
The full algorithm is described in docs/how_it_works.md.
Requires Python 3.8 or newer.
pip install .To also transcribe page images (the HTR step), install the htr extra, which
pulls in Kraken, Pillow and PyMuPDF:
pip install ".[htr]"Go to docs/installation.md to see the installation of Kraken models.
The installed command scripture-indexer runs everything in one go:
scripture-indexer path/to/pagesThis writes index.yaml with the page index.
If you already have transcriptions and only want the indexing part:
python -m scripture_indexer.run_pipeline page1/transcription.txt page2/transcription.txt \
--output index.jsonTo make sure everything is working on your system, try out the minimal example bundled with the repo (excerpt from Toulouse MS91):
scripture-indexer example/page1.pdfThis should return in your console and in the file pipeline_output/index.yaml the following index:
optimizer: global
min_reference_words: 30
missing_verse_tolerance: 2
excluded_books: []
pages:
- page: page1__page_0001
readings:
- reference: Acts of Apostles 8:14–17
continues_from_previous_page: false
continues_on_next_page: false
- reference: John 10:1–10
continues_from_previous_page: false
continues_on_next_page: falseMore information: docs/quickstart.md. All commands and options: docs/cli.md.
A demonstration Web application, still under development, is available in the folder app:
python -m streamlit run app.py | Document | Contents |
|---|---|
| Overview | What the tool does and how the pieces fit together |
| Installation | Requirements, extras, models |
| Quickstart | First run, step by step |
| How it works | The algorithm, explained for humans |
| CLI reference | Every command and option |
| Output formats | What each output file contains |
MIT — see LICENSE.
