rsword_chirho
Pure Rust port of the SWORD Bible software library.
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
Features
- Full SWORD compatibility: Read all standard SWORD module binary formats
- Multiple module types: Bibles, commentaries, lexicons, general books, devotionals
- Compression support: zlib, bzip2, and xz compression
- Full-text search: Tantivy-based indexed search with regex fallback
- Multiple versifications: KJV, Catholic, LXX, Synodal, Luther, Vulgate, NRSV, Leningrad, Ethiopian
- Markup filters: Convert OSIS, ThML, GBF to HTML or plain text
- Import tools: OSIS, TEI, VPL, and IMP format parsers
- Encrypted modules: Support for cipher-protected content
Installation
[]
= "0.1"
Feature Flags
[]
= { = "0.1", = ["bzip2", "xz", "search"] }
| Feature | Default | Description |
|---|---|---|
bzip2 |
Yes | bzip2 compression support |
xz |
Yes | xz/lzma compression support |
search |
Yes | Tantivy full-text search |
parallel |
No | Parallel processing with rayon |
Quick Start
use ;
Verse Navigation
use VerseKeyChirho;
// Parse various reference formats
let key1_chirho = from_str_chirho?;
let key2_chirho = from_str_chirho?; // Abbreviation
let key3_chirho = from_str_chirho?; // Numbered book
let key4_chirho = from_str_chirho?; // Last verse
// Navigate through verses
let mut key_chirho = from_str_chirho?;
key_chirho.increment_chirho; // Move to Genesis 1:2
key_chirho.increment_chirho; // Move to Genesis 2:1 (crosses chapter)
// Get verse components
let book_chirho = key_chirho.get_book_name_chirho;
let chapter_chirho = key_chirho.get_chapter_chirho;
let verse_chirho = key_chirho.get_verse_chirho;
Versification Systems
Different Bible traditions use different verse numbering:
use ;
// Available systems
let manager_chirho = new_chirho;
for name_chirho in manager_chirho.list_available_chirho
// Output: KJV, Catholic, LXX, Synodal, Luther, Vulgate, NRSV, Leningrad, Ethiopian
// Get a specific versification
let kjv_chirho = get_versification_chirho.unwrap;
let catholic_chirho = get_versification_chirho.unwrap;
Search
use ;
// Create search options
let options_chirho = new_chirho
.with_type_chirho
.case_insensitive_chirho
.with_max_results_chirho;
// Search using regex engine (no index required)
let search_chirho = new_chirho;
let results_chirho = search_chirho.search_chirho?;
// For better performance, use Tantivy indexed search
let mut tantivy_chirho = new_chirho?;
if !tantivy_chirho.has_index_chirho
let results_chirho = tantivy_chirho.search_chirho?;
Filters
Convert module markup to different formats:
use ;
let filter_chirho = new_chirho;
let osis_chirho = r#"<verse osisID="John.3.16">For God so loved...</verse>"#;
let html_chirho = filter_chirho.process_chirho?;
Module Types Supported
| Type | Description | Storage Formats |
|---|---|---|
| zText | Compressed Bible modules | Block-compressed with zlib/bzip2/xz |
| RawText | Uncompressed Bible modules | 6-byte or 8-byte index |
| zCom | Compressed commentary | Block-compressed |
| RawCom | Uncompressed commentary | 6-byte or 8-byte index |
| zLD | Compressed lexicon/dictionary | Block-compressed |
| RawLD | Uncompressed lexicon | 6-byte or 8-byte index |
| RawGenBook | General book modules | Tree-structured |
Installing Modules
use InstallMgrChirho;
let mut install_mgr_chirho = new_chirho;
install_mgr_chirho.init_chirho?;
install_mgr_chirho.sync_config_chirho?;
// List available modules from CrossWire
let modules_chirho = install_mgr_chirho.get_remote_modules_chirho?;
for m_chirho in modules_chirho
// Install a module
install_mgr_chirho.install_module_chirho?;
Importing Content
Create modules from source formats:
use ;
// Parse OSIS XML
let config_chirho = default;
let mut parser_chirho = new_chirho;
let doc_chirho = parser_chirho.parse_file_chirho?;
for verse_chirho in &doc_chirho.verses_chirho
CLI Tools
The sword_tools_chirho crate provides CLI tools:
diatheke_chirho- Bible text lookup and searchinstallmgr_chirho- Module installation managementosis2mod_chirho- Create modules from OSIS XMLtei2mod_chirho- Create lexicons from TEI XMLmod2imp_chirho- Export modules to IMP format
API Documentation
Run cargo doc --open to generate and view the full API documentation.
License
GPL-2.0-or-later (same as SWORD library)