AI-powered detection and analysis of biblical quotations, paraphrases, and allusions in historical texts.
Developed by Dr. William J.B. Mattingly, Cultural Heritage Data Scientist at Yale University.
Built for the international workshop Ruse of Reuse: Detecting Text-similarity with AI in Historical Sources — held March 5–6, 2026 at the Austrian Academy of Sciences, Vienna.
Scripture Detector is a local web application that uses Google Gemini to automatically find, classify, and annotate every biblical reference in any text you provide — from full verbatim quotations to subtle allusions. It renders an interactive, color-coded view of the source text with side-by-side Bible verse lookup, distribution charts, and a manual annotation editor.
The only external dependency is a free Gemini API key from Google AI Studio. No cloud account, credit card, or additional infrastructure is required.
Manage all your text sources. Use the search bar to search source content in real time, or open the Advanced panel to stack filters by Bible book, chapter, or verse with AND / OR logic. Match evidence appears directly on each result card.
Color-coded annotations appear directly in the text. Click any highlighted passage to see the matched Bible verse(s) in the panel on the right.
Explore scripture distribution across all sources — broken down by Bible book, testament, and quote type.
Configure your Gemini API key or Google Vertex AI credentials, and select which Gemini model to use.
Full documentation of the application, its features, and how it works.
- Full-document AI analysis — send any text to Gemini and receive a structured list of every scripture reference with verse citations and classification types.
- Four classification types: Full, Partial, Paraphrase, and Allusion.
- Color-coded in-text highlighting — each type is rendered in a distinct color directly within the source text.
- Click-to-explore interactivity — click a highlighted passage to highlight the corresponding annotation card, and vice versa.
- Selection-based re-analysis — highlight any portion of the text to re-run AI detection on just that selection.
- Manual annotation editor with an integrated Bible verse picker (book → chapter → verse).
- Advanced search — real-time multi-filter search across all sources by text content, Bible book, chapter, or verse; filters stack with AND / OR logic and matched evidence appears inline on each result card.
- Distribution charts per source and across all sources (by Bible book, testament, and type).
- Global analytics dashboard aggregating data across all sources.
- Model switching — choose between available Gemini model versions in the UI.
- Runs entirely locally — your texts are never transmitted anywhere except for the Gemini API call itself.
The Sources page includes a real-time multi-filter search system:
| Filter Type | What it matches |
|---|---|
| Text Content | Any source whose full text contains the search string |
| Bible Book | Any source with at least one reference to the chosen book |
| Chapter | Any source with a reference to the chosen chapter (e.g. Psalms 23) |
| Verse | Any source with a reference to the exact chosen verse (e.g. John 3:16) |
Filters can be stacked in any combination. The AND mode requires a source to satisfy every filter; OR mode returns sources satisfying any filter. Results update within ~350 ms of each keystroke or dropdown change. Matched text snippets and verse citations appear as inline evidence on each result card.
- Python 3.10+
- uv (recommended) or pip
- A free Gemini API key from Google AI Studio
git clone <repo-url>
cd scripture-detector
# Using uv (recommended)
uv run python app.py
# Or using pip
pip install -e .
python app.pyThe app starts at http://127.0.0.1:5001.
- Open http://127.0.0.1:5001/settings
- Select Gemini API as the provider
- Paste your API key from Google AI Studio
- Click Save Settings
- Go to the Sources page and click Add Source
- Give your source a name and paste in the text to analyze
- Click View to open the text viewer
- Click Process with AI — Gemini will detect all scripture references within seconds
- Click any highlighted passage to explore the matched Bible verses
| Type | Description |
|---|---|
| Full | A complete or near-complete verse quoted verbatim |
| Partial | A recognizable portion of a verse with minor variation or truncation |
| Paraphrase | Biblical content restated in different words, preserving the meaning |
| Allusion | A brief phrase, thematic echo, or indirect reference to a specific verse |
scripture-detector/
├── app.py # Flask application and API routes
├── database.py # SQLite database layer
├── main.py # CLI batch evaluation script
├── data/
│ ├── bible.tsv # Full Bible verse database (35,000+ verses)
│ └── book_mapping.tsv
├── templates/
│ ├── sources.html # Sources listing page
│ ├── viewer.html # Annotated text viewer
│ ├── dashboard.html # Global analytics dashboard
│ ├── settings.html # API configuration
│ └── about.html # About / documentation page
└── static/
├── style.css # Yale color palette stylesheet
├── logo.svg # Application logo
└── favicon.svg # Browser tab icon
The simplest option. Get a free key at Google AI Studio — no billing required. Select Gemini API in Settings and paste your key.
For enterprise use or higher rate limits. Requires a Google Cloud project with Vertex AI enabled. Select Vertex AI in Settings and enter your project ID and location.
Developer: Dr. William J.B. Mattingly
Affiliation: Yale University, Cultural Heritage Data Scientist
Workshop: Ruse of Reuse: Detecting Text-similarity with AI in Historical Sources
Workshop Dates: March 5–6, 2026
Workshop Venue: Austrian Academy of Sciences, PSK Georg-Coch-Platz 2, 1010 Vienna
Organisers: Digital Lab, Institute for Medieval Research, Austrian Academy of Sciences & SOLEMNE, Radboud University
MIT




