Bahai Chinese Translation Workbench

Sacred text translation pipeline with human governance

Claude Sonnet 4.6 FastAPI SQLite Docker

Project Overview

Challenge: A team of 27 volunteer translators works to translate Baha'i sacred writings into Chinese. Working manually, they complete approximately 1 book per year. Each translation must meet three rigorous standards: accuracy (准确) — faithful to the original meaning; beauty (文风优美) — elevated, literary Chinese register worthy of sacred scripture; and consistency (风格一致) — uniform terminology and style aligned with the tradition established by Shoghi Effendi.

Solution: The Bahai Chinese Translation Workbench is an AI-assisted pipeline that accelerates translation throughput to an estimated 4-6 books per year while preserving human governance over every translation decision. The system implements a 3-stage pipeline — AI Translation, Human Review, and AI Editing — where no translation advances without explicit human approval.

Key Benefits

Application Features

AI Translation with Glossary

Stage 1 generates a Chinese translation draft using Claude Sonnet 4.6. The prompt includes the full 20-term terminology glossary to ensure proper nouns, theological terms, and scripture titles are translated consistently.

Side-by-Side Comparison

Source text and Chinese translation are displayed in a two-panel layout. Reviewers can read the original and translation simultaneously, making it easy to verify accuracy and completeness.

Human Review Gate

Stage 2 places the translation under human governance. Reviewers can approve (pass as-is), edit (modify and pass), or reject (block and flag). No translation advances without a human decision.

AI Editing with Checklist

Stage 3 refines the approved translation for grammar, punctuation, tone, and terminology uniformity. The AI editor evaluates against all three standards and reports a checklist with assessment notes.

Terminology Glossary Sidebar

A searchable sidebar displays all 20 approved glossary terms with English, Chinese translations, and usage notes. The glossary is accessible at any stage for quick reference.

AI Integration

Three-Standard Framework

Both the translation and editing prompts encode the three quality standards — accuracy (准确), beauty (文风优美), and consistency (风格一致) — directly into the system prompt. The AI evaluates and reports against each standard.

Glossary Injection

The 20-term glossary is formatted and injected into every AI prompt. Terms cover persons (Baha'u'llah, Abdu'l-Baha), institutions (Universal House of Justice), theology (Manifestation of God), and scripture titles (Kitab-i-Aqdas).

JSON Structured Output

AI agents return structured JSON with translation text, term usage reports, and notes. A recursive unwrapping function handles cases where the LLM wraps output in markdown fences or nested JSON objects.

Stage Gate Logic

The backend enforces strict stage sequencing. Documents must complete Stage 1 before review, and Stage 2 before editing. The review endpoint validates the decision (approve/edit/reject) and routes accordingly.

Technical Architecture

Backend

Python 3 FastAPI Anthropic SDK Claude Sonnet 4.6 SQLite Pydantic

Frontend

Vanilla HTML Vanilla JavaScript CSS (No Framework)

Deployment

Docker Google Cloud Run

System Design

Setup Guide

Prerequisites

Quick Start

# Clone the repository git clone https://github.com/lyven81/ai-project.git cd ai-project/projects/bahai-chinese-translation-workbench # Install dependencies pip install -r requirements.txt # Set up environment variables # Create a .env file with your API key: # ANTHROPIC_API_KEY=your_api_key_here # Run the app python app.py

Environment Configuration

# Required API Configuration ANTHROPIC_API_KEY=your_anthropic_api_key_here

Docker Deployment

# Build and run with Docker docker build -t bahai-translation-workbench . docker run -p 8080:8080 -e ANTHROPIC_API_KEY=your_key bahai-translation-workbench

Key Metrics

3
Pipeline Stages
20
Glossary Terms
3
Quality Standards
Side-by-Side
Comparison View

Translation Quality Standards