An AI-powered study companion for preparing for biblical exams in the LLM era
This project demonstrates how students can leverage Large Language Models (LLMs) to prepare for comprehensive exams. Using the Book of Kings as a case study, it shows how AI can help create structured study materials, character indices, and location references—all automatically generated from biblical texts.
This is a proof-of-concept (PoC) project that explores how modern AI technology can assist students in preparing for traditional exams, particularly those requiring extensive memorization and comprehension of large texts. The project specifically targets Hebrew Bible proficiency exams by:
- Automatically generating chapter summaries
- Extracting and indexing characters with descriptions
- Cataloging important locations
- Creating a comprehensive study document in Hebrew
- Automatic Text Retrieval: Downloads biblical chapters from Sefaria API
- AI-Powered Summarization: Uses Google's Gemini AI to create concise chapter summaries
- Character Extraction: Identifies and describes all characters mentioned in each chapter
- Location Mapping: Lists and describes important places
- Hebrew Support: Full right-to-left (RTL) Hebrew text support
- Document Generation: Creates a formatted Word document (.docx) with:
- Chapter-by-chapter plot summaries with Hebrew numerals
- Alphabetically sorted character index with descriptions and chapter references
- Alphabetically sorted location index with descriptions and chapter references
- Python 3.x
- A Google Gemini API key (Get one here)
- Clone the repository:
git clone <repository-url>
cd kings- Install dependencies:
pip install -r requirements.txt- Set your Gemini API key:
export GEMINI_API_KEY='your-api-key-here'Run the main script to process both books of Kings:
./kings.pyOr with Python:
python3 kings.pyThe script will:
- Download chapter texts from Sefaria (if not already cached)
- Generate AI summaries for each chapter (if not already generated)
- Compile a comprehensive study document:
kings_summary.docx
kings/
├── kings.py # Main entry point
├── kings_text.py # Handles downloading and caching biblical texts
├── analyzer.py # AI-powered chapter analysis using Gemini
├── summarizer.py # Compiles summaries into a Word document
├── prompt.tmpl # Template for AI prompts (in Hebrew)
├── system_instructions.tmpl # AI system instructions
├── response.tmpl # JSON response format template
├── requirements.txt # Python dependencies
└── data/ # Cached texts and summaries
├── I_Kings_*.text.txt
├── I_Kings_*.summary.json
├── II_Kings_*.text.txt
└── II_Kings_*.summary.json
- Fetches chapter texts from the Sefaria API
- Caches downloaded texts locally to avoid redundant API calls
- Handles HTML entity conversion for clean text
- Uses Pydantic models to define structured output schema
- Sends chapter text to Google Gemini 2.5 Flash model
- Requests JSON-formatted responses with:
- 100-word Hebrew synopsis
- List of all characters with descriptions
- List of all locations with descriptions
- Caches results to avoid re-processing
- Aggregates character and location information across all chapters
- Creates a Word document with RTL Hebrew support
- Organizes content into three sections:
- Plot (עלילה): Sequential chapter summaries
- Characters (דמויות): Alphabetical character index
- Places (מקומות): Alphabetical location index
- Processes all 21 chapters of I Kings
- Processes all 25 chapters of II Kings
- Coordinates the workflow from download to document generation
The generated document includes entries like:
Plot Section:
(א) המלך דוד זקן ותשוש, ואבישג השונמית משרתת אותו. בנו אדוניהו מנצל את המצב ומנסה לתפוס את המלוכה...
Character Index:
דוד המלך: מלך ישראל המזדקן והתשוש, שבסוף ימיו מורה למשוח את שלמה למלך. מלכים א פרק א, מלכים א פרק ב
This project demonstrates several important concepts for modern learners:
- Automated Study Material Creation: Transform large texts into manageable study guides
- Structured Knowledge Extraction: Convert narrative text into organized reference materials
- AI-Assisted Learning: Leverage AI as a study companion, not a replacement for learning
- Smart Caching: Efficient processing by avoiding redundant API calls and computations
- Python 3: Core programming language
- Google Gemini AI: For intelligent text analysis and summarization
- Pydantic: For structured data validation and schema definition
- python-docx: For Word document generation with Hebrew/RTL support
- hebrew-numbers: For converting chapter numbers to Hebrew numerals (gematria)
- Sefaria API: For accessing biblical texts