🦀📖

rsword_chirho

Pure Rust Port of the SWORD Bible Software Library

crates.io License Rust
"For God so loved the world that he gave his only begotten Son, that whoever believes in him should not perish but have eternal life." — John 3:16

Quick Start

Cargo.toml
# Add to your Cargo.toml
[dependencies]
rsword_chirho = "0.1"
main.rs
use rsword_chirho::{SwMgrChirho, VerseKeyChirho};

fn main_chirho() -> Result<(), Box<dyn std::error::Error>> {
    // Load modules from system paths (~/.sword, /usr/share/sword, etc.)
    let mgr_chirho = SwMgrChirho::with_system_paths_chirho()?;

    // List available modules
    for name_chirho in mgr_chirho.get_module_names_chirho() {
        println!("Found module: {}", name_chirho);
    }

    // Get a Bible module and look up a verse
    if let Some(mut module_chirho) = mgr_chirho.get_module_driver_chirho("KJV")? {
        let key_chirho = VerseKeyChirho::from_str_chirho("John 3:16")?;
        module_chirho.set_key_chirho(&key_chirho)?;
        let text_chirho = module_chirho.get_raw_entry_chirho()?;
        println!("{}: {}", key_chirho, text_chirho);
    }

    Ok(())
}

Features

Full Binary Format Support

Complete compatibility with SWORD module binary formats: RawText, RawText4, zText, RawCom, zCom, RawLD, zLD, RawGenBook.

Compression Support

Built-in support for zlib, bzip2, and xz/lzma compression formats used by modern SWORD modules.

Versification Systems

KJV, Catholic, LXX, Vulgate, Luther, Synodal, NRSV, Leningrad, and Ethiopian verse numbering systems.

Full-Text Search

Tantivy-powered search with Boolean operators, wildcards, fuzzy matching, and phrase search.

Markup Filters

Convert OSIS, ThML, and GBF markup to HTML or plain text. Extract Strong's numbers, morphology, footnotes.

Module Management

Install modules from CrossWire and other SWORD repositories. List, update, and remove modules.

CLI Tools

Drop-in replacements for diatheke, installmgr, osis2mod, and other SWORD command-line utilities.

Pure Rust

No C++ dependencies. Cross-compiles to any target Rust supports. WebAssembly ready.

Module Format Support

Type Driver Description
Biblical Texts RawTextChirho, ZTextChirho Bible translations with verse-keyed access
Commentaries RawComChirho, ZComChirho Verse-keyed commentary content
Lexicons RawLdChirho, ZLdChirho Dictionaries, Strong's concordances
General Books RawGenBookChirho Tree-structured content
Daily Devotional DailyDevotionalChirho Date-keyed devotional readings

CLI Tools

$ diatheke_chirho -b KJV -k "John 3:16"
John 3:16: For God so loved the world, that he gave his only begotten Son...
$ diatheke_chirho -b KJV -s phrase -k "love"
# Search for "love" in KJV module
$ installmgr_chirho -rl CrossWire
# List available modules from CrossWire repository
$ installmgr_chirho -ri CrossWire KJV
# Install KJV module from CrossWire

Architecture

rsword_chirho/
├── keys_chirho/          # Key types (VerseKey, TreeKey, StrKey, DateKey)
├── versification_chirho/ # Verse systems (KJV, Catholic, LXX, etc.)
├── modules_chirho/       # Module drivers (RawText, zText, RawLD, etc.)
├── storage_chirho/       # Binary format handlers (RawVerse, ZVerse)
├── compression_chirho/   # Compression (zlib, bzip2, xz)
├── filters_chirho/       # Markup filters (OSIS, ThML, GBF → HTML/plain)
├── search_chirho/        # Search engines (Tantivy, Regex)
├── manager_chirho/       # Module & Install managers
├── transport_chirho/     # FTP/HTTP for module downloads
├── import_chirho/        # OSIS/TEI/IMP parsers
└── locale_chirho/        # Internationalization
            
Module Loading Pipeline
// .conf file → ModuleConfigChirho → ModuleFactory → SwModule
//                                         ↓
//                     storage_chirho (RawVerse/ZVerse/RawStr)
//                                         ↓
//                     SwModuleChirho trait (read/iterate/search)

Related Projects

📖 Codex Lux Chirho ⚔️ SWORD Project