Skip to main content

Scripture Lookup

Scripture Lookup is a Python library and command-line tool for looking up scripture verses or chapters. It can also detect scripture references in a string, and convert them between formats and languages. The tool uses scripture and language metadata from Python Scripture Scraper.

Installation

  1. Install Python 3 and the Homebrew package manager (if you don’t already have them installed).
  2. Install icu4c via Homebrew:
brew install icu4c
  1. Install Scripture Lookup:
pip install scripturelookup

Command-line usage

Pattern:

scripturelookup [command] [input] [options]

Examples:

% scripturelookup get_content "john 3:16" --lang "en"
16 ¶ For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.

% scripturelookup get_label "니파이전서 3:7" --lang "fr" --abbreviated
1 Né 3:7

% scripturelookup get_church_url "helaman 5:12"
https://www.churchofjesuschrist.org/study/scriptures/bofm/hel/5?id=p12&lang=eng#p12

% scripturelookup get_label "/scriptures/nt/1-jn/3.2-3" --lang "cmn-Hant"
約翰一書3:2-3

% scripturelookup get_church_url "/scriptures/ot" --lang "es"
https://www.churchofjesuschrist.org/study/scriptures/ot?lang=spa

% scripturelookup detect_references "As Nephi taught in 1 Ne. 3:7, and again in 2 Nephi 2:25."
[['1 Ne. 3:7', 19, 28], ['2 Nephi 2:25', 43, 55]]

% scripturelookup refresh_metadata
Updated metadata: metadata-languages.min.json, metadata-scriptures.min.json

Python usage

Examples:

from scripturelookup import lookup

lookup.get_content('john 3:16', lang = 'en')
# 16 ¶ For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.

lookup.get_label('니파이전서 3:7', lang = 'fr', abbreviated = True)
# 1 Né 3:7

lookup.get_church_url('helaman 5:12')
# https://www.churchofjesuschrist.org/study/scriptures/bofm/hel/5?id=p12&lang=eng#p12

lookup.get_label('/scriptures/nt/1-jn/3.2-3', lang = 'cmn-Hant')
# 約翰一書3:2-3

lookup.get_church_url('/scriptures/ot', lang = 'es')
# https://www.churchofjesuschrist.org/study/scriptures/ot?lang=spa

lookup.detect_references('As Nephi taught in 1 Ne. 3:7, and again in 2 Nephi 2:25.')
# [['1 Ne. 3:7', 19, 28], ['2 Nephi 2:25', 43, 55]]

lookup.refresh_metadata()
# Updated metadata: metadata-languages.min.json, metadata-scriptures.min.json

Commands, inputs, and options

Commands

  • get_content – Get chapter or verse content.
  • get_label – Get a scripture reference label (i.e. "John 3:16").
  • get_church_uri – Get a Gospel Library URI (i.e. "/scriptures/bofm/hel/5.12").
  • get_church_url – Get a Gospel Library URL.
  • get_church_link – Get an HTML link to Gospel Library.
  • get_reference_objects – Get a list of references as objects.
  • get_reference_attributes – Get a list of references as dictionaries.
  • sort_references – Sort a list of references by label or in traditional book order.
  • detect_references – Find scripture references embedded in a string of text.
  • refresh_metadata – Download the latest scripture and language metadata. Takes no input.

Inputs

Any of the following input types are supported. You can also provide several inputs at once as a list (separated by semicolons or line-breaks).

detect_references takes an arbitrary text string and returns a list of [label, start_offset, end_offset]. The label is the exact detected text (not normalized). Start and end offset indicate the exclusive range of characters in the input string where the reference was found.

Options

Several options are available. Some are only applicable to certain commands.

  • lang (optional) – Output language. BCP 47 language codes and Gospel Library language codes are supported. Default: 'en'.
  • separator (optional) – String separator between outputs when a list of references is requested. Default: '\n'.
  • sort_by (optional) – Method for sorting references. Default: 'none'. Supported values: 'none', 'traditional', or 'label'.
  • source (optional) – Content source. Default: 'python-scripture-scraper'. Supported values: 'python-scripture-scraper' or 'ChurchofJesusChrist.org'.
  • link_class (optional) – String for the “class” attribute on links. Default: None.
  • link_target (optional) – String for the “target” attribute on links. Default: None.
  • use_query_parameters (optional) – Whether query parameters should be used on URIs. Default: False.
  • skip_lang (optional) – Whether “lang” query parameters should be skipped on URLs. Default: False.
  • skip_fragment (optional) – Whether fragments should be skipped on URLs. Default: False.
  • skip_book_name (optional) – Whether book names should be skipped on labels. Default: False.
  • abbreviated (optional) – Whether book abbrevions should be used on labels. Default: False.
  • skip_cleanup (optional) – Whether cleanup of the input string should be skipped when parsing. Can be used to speed up parsing if the input string is guaranteed to have well-formed references. Default: False.
  • range_split_limit (optional) – Threshold where a range of sequential verses will be split into separate verse groups. Default: 1.

Acknowledgements

Python Scripture Scraper – tool for scraping scripture content and metadata from ChurchofJesusChrist.org. geezify-python – tool for converting numbers to and from Geez numerals.

Metadata

Release files for scripturelookup 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scripturelookup 0.1.1
File Size Uploaded
scripturelookup-0.1.1.tar.gz 220.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scripturelookup 0.1.1
File Interpreter ABI Platform
scripturelookup-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 439.2 kB

Release files / scripturelookup-0.1.1.tar.gz

Download URL scripturelookup-0.1.1.tar.gz
Size 220.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f6059b504019a1e0ce90ce6e18714b467b26a7558e929711e4d5340550c70628
BLAKE2b-256 checksum
How to use checksums
7eacfc99be4f7a7971dd550bdf4887ab2587638f7d5065ac742c57b7ee1d58bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / scripturelookup-0.1.1-py3-none-any.whl

Download URL scripturelookup-0.1.1-py3-none-any.whl
Size 218.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01fb745efa1a8d7682ce26df4611a33573213a99b42bec46eeb68d4758132772
BLAKE2b-256 checksum
How to use checksums
aac20eb5e3fe45c6c7e6de3d818f2f127a00cc429ede9a13a72df73789adc7f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page