A desktop application for converting epigraphic and papyrological inscriptions from Leiden Convention format to EpiDoc XML using Claude AI.
This application provides a user-friendly GUI for converting inscriptions written in Leiden Convention to properly formatted EpiDoc XML. It leverages Anthropic's Claude AI to perform accurate, context-aware conversions while preserving all meaningful information.
- AI-Powered Conversion: Uses Claude AI for intelligent Leiden to EpiDoc translation
- Intelligent Prompt Caching: Reuses Claude prompt prefixes during multi-file batches while bypassing cache overhead for single-file conversions
- Native GUI: Clean, responsive interface built with PySide6/Qt
- Unicode Support: Full support for Greek, Hebrew, Arabic, and other ancient scripts
- RTL Languages: Automatic right-to-left text rendering for Hebrew, Arabic, and Syriac
- File Management: Load Leiden text from files and save EpiDoc XML output
- Configurable: Customize API settings and default save locations
- Cross-Platform: Runs on Linux, Windows, and macOS with native appearance
Pre-built executables are available for Windows and macOS. No Python installation required!
Download the latest release for your platform from the Releases page:
| Platform | File | Instructions |
|---|---|---|
| Windows | LeidenToEpiDoc-Windows.zip |
Download, unzip, and run the .exe |
| macOS | LeidenToEpiDoc-Mac.zip |
Download, unzip, and open the .app |
- Download
LeidenToEpiDoc-Windows.zipfrom the latest release - Extract the ZIP file to a folder (e.g., right-click → Extract All…)
- Open the extracted folder and double-click
LeidenToEpiDoc.exeto run the application - On first launch, go to Settings → Configure API and enter your Anthropic API key
Windows SmartScreen: Since the app is not code-signed, Windows may show a "Windows protected your PC" warning on first launch. Click More info → Run anyway to proceed.
- Download
LeidenToEpiDoc-Mac.zipfrom the latest release - Double-click the ZIP file to extract it (creates
leiden-epidoc.app) - Right-click the app and select Open (required for first launch since the app is not notarized)
- If prompted, click Open again in the security dialog
- On first launch, go to Settings → Configure API and enter your Anthropic API key
Note: You will need an Anthropic API key to use this application. Get one at console.anthropic.com.
- Python 3.12 or higher
- An Anthropic API key (get one here)
Using uv (recommended):
uv syncOr using pip:
pip install -e .Using uv:
uv run python leiden-epidoc.pyOr directly with Python:
python leiden-epidoc.py- Launch the application
- Go to Settings → Configure API
- Enter your Anthropic API key
- (Optional) Select a different Claude model if desired
- Click Save
-
Input Leiden text:
- Type directly into the input box, or
- Click Load from File to load a
.txtfile
-
Convert:
- Click the Convert to EpiDoc button
- Wait for the conversion to complete (status shown in status bar)
-
Save output:
- Review the EpiDoc XML in the output box
- Click Save Output to File to save as
.xml
- Configure API: Set or change your Anthropic API key and model
- Set Save Location: Choose default directory for saving output files
Settings are stored in leiden_epidoc_config.json in the application directory:
{
"api_key": "your-api-key-here",
"model": "claude-sonnet-4-20250514",
"save_location": "/path/to/save/directory",
"prompt_cache_batch_threshold": 2
}Prompt caching lives in LeidenToEpiDocConverter.should_use_prompt_cache() and
LeidenToEpiDocConverter._build_request_params() in leiden-epidoc.py.
Those methods only attach Anthropic cache controls when a conversion batch meets
the configurable prompt_cache_batch_threshold (default 2), because the
cache write cost is only recovered when the same prompt prefix is reused by
later requests in the batch. Single-file conversions intentionally bypass the
cache and keep the original request shape.
The focused regression tests in tests/test_prompt_caching.py demonstrate the
intended savings pattern: the first request in a batch can create the cache and
later requests can read from it, while one-off conversions remain uncached.
- LeidenToEpiDocConverter: Core conversion logic, API client management
- ConversionThread: Background thread for non-blocking API calls
- LeidenEpiDocGUI: Main application window (QMainWindow)
- APISettingsDialog: Dialog for API configuration
- SaveLocationDialog: Dialog for setting default save location
- PySide6: Qt bindings for Python (GUI framework)
- Anthropic API: Claude AI for conversion logic
- Python 3.12+: Modern Python with type hints
This project includes a comprehensive test suite to ensure code quality and reliability.
Install test dependencies:
pip install -e ".[test]"Run all tests:
pytestRun tests with coverage report:
pytest --cov=. --cov-report=htmlRun specific test files:
pytest tests/test_converter.py
pytest tests/test_prompts.py
pytest tests/test_integration.pyRun tests by marker:
pytest -m unit # Run only unit tests
pytest -m integration # Run only integration testsThe test suite is organized into several categories:
-
tests/test_converter.py: Unit tests for theLeidenToEpiDocConverterclass- Configuration loading and saving
- Response parsing logic
- Error handling
- Custom prompt/examples functionality
- Regex pattern validation
-
tests/test_file_item.py: Unit tests for theFileItemclass- File loading and content management
- Unicode support
- File property handling
-
tests/test_prompts.py: Tests for the prompt system- System instruction validation
- Examples structure verification
- Leiden Convention coverage
- EpiDoc tag coverage
-
tests/test_integration.py: Integration tests for complete workflows- End-to-end conversion workflows
- Configuration management
- Custom prompts and examples
- File handling and batch operations
The test suite covers:
- ✅ Configuration loading and saving
- ✅ File loading and content management
- ✅ Response parsing with various tag combinations
- ✅ Error handling (missing API key, file errors, API errors)
- ✅ Custom prompts and examples
- ✅ Unicode and multilingual text support
- ✅ Batch file processing
- ✅ Output file naming and collision handling
- ✅ Leiden Convention and EpiDoc instruction validation
The application uses Qt's native widgets and automatically adapts to your operating system:
- Linux: GTK/KDE integration with system theme
- Windows: Native Windows controls and styling
- macOS: Native macOS appearance and behavior
Qt automatically handles Unicode text rendering for:
- Latin (basic and extended)
- Greek (including polytonic)
- Hebrew
- Arabic
- Coptic
- Cyrillic
- Syriac
- Armenian
- And many more...
See LICENSE file for details.
Contributions welcome! Please submit issues and pull requests on GitHub.