Skip to main content

Utility functions for dealing with biblicial references

Project description

Test PyPI version

acdh-bible-pyutils

Utility functions for dealing with biblicial references

install

pip install acdh-bible-pyutils

or

uv add acdh-bible-pyutils

use

get bible book from biblical reference

from acdh_bible_pyutils import get_book_from_bibl_ref, BIBLE_BOOK_LOOKUP


book = get_book_from_bibl_ref("Lk. 19,41")
print(book)
>>> {"order": 51, "title_eng": "Luke", "title_deu": "Lukas", "title_lat": "Lucas"}

bible_refs = [
    "Lk. 19,41",
    "Mt. 27,52",
    "2 Kings 2:23-24",
    "4 Reg. 2,23",
    "2 Sam. 6,16",
    "88Sam 6,16",
]
for x in bible_refs:
    book = get_book_from_bibl_ref(x)
    print(f"{x} resolves to: **{book["title_lat"]} / {book["title_deu"]}**, order-nr: {book["order"]}")

>>> Lk. 19,41 resolves to: **Lucas / Lukas**, order-nr: 51
>>> Mt. 27,52 resolves to: **Matthaeus / Matthäus**, order-nr: 49
>>> 2 Kings 2:23-24 resolves to: **2 Regum / 2. Könige**, order-nr: 12
>>> 4 Reg. 2,23 resolves to: **4 Regum / 4. Könige**, order-nr: 14
>>> 2 Sam. 6,16 resolves to: **2 Samuel / 2. Samuel**, order-nr: 10
>>> 88Sam 6,16 resolves to: **88Sam 6,16 / 88Sam 6,16**, order-nr: 0


BIBLE_BOOK_LOOKUP["Lk"]
>>> {"order": 51, "title_eng": "Luke", "title_deu": "Lukas", "title_lat": "Lucas"}

normalize biblical references

from acdh_bible_pyutils import normalize_bible_refs
bible_refs = [
    "Lk. 19,41-50",
    "Mt. 27,52",
    "2 Kings 2:23-24",
    "4 Reg. 2,23",
    "2 Sam. 6,16",
    "88Sam 6,16",
]
for x in bible_refs:
    print(normalize_bible_refs(x))
>>> {"order": 51, "title_eng": "Luke", "title_deu": "Lukas", "title_lat": "Lucas", "chapter": 19, "verse_start": 41, "verse_end": 50}
>>> {"order": 49, "title_eng": "Matthew", "title_deu": "Matthäus", "title_lat": "Matthaeus", "chapter": 27, "verse_start": 52, "verse_end": 0}
>>> {"order": 12, "title_eng": "2 Kings", "title_deu": "2. Könige", "title_lat": "2 Regum", "chapter": 2, "verse_start": 23, "verse_end": 24}
>>> {"order": 14, "title_eng": "4 Kings", "title_deu": "4. Könige", "title_lat": "4 Regum", "chapter": 2, "verse_start": 23, "verse_end": 0}
>>> {"order": 10, "title_eng": "2 Samuel", "title_deu": "2. Samuel", "title_lat": "2 Samuel", "chapter": 6, "verse_start": 16, "verse_end": 0}
>>> {"order": 0, "title_eng": "88Sam 6,16", "title_deu": "88Sam 6,16", "title_lat": "88Sam 6,16", "chapter": 88, "verse_start": 0, "verse_end": 0}

## build

```shell
uv build

cheat sheet

sort imports

ruff check --select I --fix

format files

ruff format

run tests

uv run pytest

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

acdh_bible_pyutils-0.2.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

acdh_bible_pyutils-0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file acdh_bible_pyutils-0.2.tar.gz.

File metadata

  • Download URL: acdh_bible_pyutils-0.2.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for acdh_bible_pyutils-0.2.tar.gz
Algorithm Hash digest
SHA256 7069c37df4755210ac6624ae86514e9d8ad57697dc0dea3269e79b60447a1607
MD5 59822d54cec7ad033907442bf9312d71
BLAKE2b-256 df683dafed6f178e49d2e7b0425742913b7768bfba8b1c255aa12874211859a2

See more details on using hashes here.

File details

Details for the file acdh_bible_pyutils-0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for acdh_bible_pyutils-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c6486eaa602a1052f511c3179dd614378bfe2aef4ba60991f88825f0e82a3b1
MD5 02a69fbf1e545a82c83726625e621f1d
BLAKE2b-256 f249fc20f3a6a94544b17a2f021852f53ecc8087bee6e9f62bf9438898da81ff

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