Skip to main content

Advanced Bible Search Library

Python Version License: MIT GitHub Issues

A comprehensive Bible text search library that combines multiple advanced search techniques to provide powerful, flexible searching of biblical texts.

Features

  • Fast Text Search: Using SQLite with FTS5 for high-performance exact text matching
  • Fuzzy Search: Powered by RapidFuzz for approximate string matching
  • Semantic Search: Using sentence-transformers for meaning-based searches
  • Topic Search: Find verses related to specific themes or concepts
  • Multiple Translations: Support for different Bible translations (KJV, ASV included)
  • Categorized Results: Results organized by book and chapter
  • Scored Results: Relevance scoring for search results

Requirements

  • Python 3.7+
  • Libraries: SQLite, RapidFuzz, sentence-transformers, etc. (see requirements.txt)

Installation

From GitHub

# Install directly from GitHub
pip install adv-bible-search

# Or install directly from GitHub
pip install git+https://github.com/siroosab/bible-search.git

# Or clone and install locally
git clone https://github.com/siroosab/bible-search.git
cd bible-search
pip install -e .

From Source

  1. Clone/download the repository
  2. Install the required dependencies:
pip install -r requirements.txt

Data Structure

The library expects Bible data in JSON format with the following structure:

{
    "books": [
        {
            "name": "Genesis",
            "chapters": [
                {
                    "chapter": 1,
                    "name": "Genesis 1",
                    "verses": [
                        {
                            "verse": 1,
                            "chapter": 1,
                            "name": "Genesis 1:1",
                            "text": "In the beginning God created the heaven and the earth."
                        },
                        // More verses...
                    ]
                },
                // More chapters...
            ]
        },
        // More books...
    ]
}

Usage

Command Line Interface

The library includes a command-line interface for searching:

# Basic search (uses all search methods)
python search_cli.py "creation"

# Specify search type
python search_cli.py --type fuzzy "creation"
python search_cli.py --type semantic "love your neighbor"
python search_cli.py --type topic "forgiveness"

# Limit number of results
python search_cli.py --limit 10 "light"

# Show relevance scores
python search_cli.py --scores "faith"

# Output in JSON format
python search_cli.py --json "hope"

Python API

from bible_search import BibleSearcher, SearchType

# Initialize the searcher
searcher = BibleSearcher(data_dir="bible_data", db_path="bible_search.db")
searcher.initialize()

# Basic search (uses all search methods)
results = searcher.search("creation")

# Specify search type
results = searcher.search("creation", search_type=SearchType.FUZZY)
results = searcher.search("love your neighbor", search_type=SearchType.SEMANTIC)
results = searcher.search("forgiveness", search_type=SearchType.TOPIC)

# Control other parameters
results = searcher.search(
    query="light", 
    search_type=SearchType.ALL,
    limit=10,
    categorize=True,
    include_scores=True
)

# Available search types:
# - SearchType.EXACT: Exact text matching using SQLite FTS5
# - SearchType.FUZZY: Approximate string matching using RapidFuzz
# - SearchType.SEMANTIC: Meaning-based search using sentence-transformers
# - SearchType.TOPIC: Theme/concept search (specialized semantic search)
# - SearchType.ALL: Combine all search methods (default)

Module Structure

  • bible_search.py: Main interface for the search library
  • database.py: SQLite database operations with FTS5
  • fuzzy_search.py: Fuzzy text matching with RapidFuzz
  • semantic_search.py: Semantic similarity search with sentence-transformers
  • search_cli.py: Command-line interface

Initial Setup

When first running the library, it will:

  1. Create an SQLite database
  2. Import Bible data from JSON files
  3. Create necessary database tables and indexes
  4. Generate semantic embeddings (this may take some time on first run)

The semantic embeddings are saved to disk for faster subsequent runs.

Search Types Explained

  1. Exact Search: Finds exact text matches using SQLite's FTS5 extension
  2. Fuzzy Search: Finds approximate matches, helpful for typos or spelling variations
  3. Semantic Search: Finds verses with similar meaning regardless of specific wording
  4. Topic Search: Specialized semantic search focused on themes and concepts

Performance Considerations

  • Semantic search requires creating embeddings which can be time-consuming on first run
  • The SQLite database provides efficient storage and fast exact searches
  • For very large datasets, consider using a more robust search engine like Elasticsearch

Metadata

Release files for adv-bible-search 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 adv-bible-search 0.1.1
File Size Uploaded Provenance
adv_bible_search-0.1.1.tar.gz 13.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 29.5 kB

Release files / adv_bible_search-0.1.1.tar.gz

Download URL adv_bible_search-0.1.1.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b16b69b1066ce6abdf1b3c272bbb7ef10a52279efaa45cf90ac585198286f404
BLAKE2b-256 checksum
How to use checksums
9168409c620c4297b551159152620757fb0cc304e5f144400ee7f9b0a6c54297
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

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

Download URL adv_bible_search-0.1.1-py3-none-any.whl
Size 16.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6703f9771e0bc10f9ca68af31b2bdab93478360d85e6dbe198fe5d335e12c5ec
BLAKE2b-256 checksum
How to use checksums
21bf1be4a24f9a73f3cae8f89bc33f73ffe5d0b45c8550fba8637828c02b6fdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.5

Security for adv-bible-search 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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