This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Indicate is a Python package for transliterating Indic text to English using PyTorch-based encoder-decoder models with attention. It ships local models for Hindi (Devanagari) and Punjabi (Gurmukhi), plus an LLM backend for other languages. The local models are custom-trained neural networks with pre-trained weights.
python -m unittest tests.test_010_hindi_translate
python -m unittest discover tests/uv sync # Install dependencies with uv (recommended)
uv build # Build package
pip install -e . # Install in development mode (alternative)# Modern Click-based CLI
indicate hindi2english "राजशेखर चिंतालपति"
indicate hindi2english --input file.txt --output result.txt
indicate infocd docs/
make html # Build HTML documentation
make clean # Clean build artifacts- Seq2SeqTransliterator (
indicate/transliterator.py) - Base lazy-loaded singleton holding the load + greedytransliterate()logic, parameterized by class attrs (vocab/weights paths, max lengths) - HindiToEnglish (
indicate/hindi2english.py) / PunjabiToEnglish (indicate/punjabi2english.py) - Thin subclasses pointing at each language's tokenizers + safetensors - Encoder (
indicate/encoder.py) -nn.ModuleLSTM encoder - Decoder (
indicate/decoder.py) -nn.ModuleLSTM decoder with Luong (dot-product) attention - Utils (
indicate/utils.py) - Tokenizer loading (load_tokenizer) and greedy decoding (translate)
- Encoder-decoder with Luong attention mechanism
- Embedding dimension: 256, LSTM units: 1024
- Per-language safetensors weights + tokenizer JSONs under
indicate/data/{hindi,punjabi}_to_english/
- PyTorch training/extraction/eval scripts live in
training/(seetraining/README.md) - Hindi corpus
data/hindi.csv.gzand Punjabi corpusdata/punjabi.csv.gzare committed (Punjabi is extracted from the Dataverse-hosted parquet viatraining/extract_punjabi.py) - Raw/large source data and the Dakshina benchmark live on Dataverse (see
data/README.md)
- Training data from ESPN Cricinfo, election affidavits, Google Dakshina dataset, and IIT Bombay corpus
- Character-level tokenization with special start (^) and end ($) tokens
- Decoding is hard-bounded by an input-adaptive step cap (no wall-clock timeout)
- CLI:
indicatecommand (Click group) withhindi2english/punjabi2englishsubcommands - API:
indicate.hindi2english(text)andindicate.punjabi2english(text)functions - Main module:
indicate/__init__.pyexposes both transliteration functions
- Python 3.13+ (modern Python with enhanced type hints)
- Click 8.0+ (modern CLI framework)
- PyTorch 2.6+ (core ML framework)
- safetensors 0.4+ (model weight serialization)
- func-timeout 4.3.0+ (prevents hanging translations)
- tqdm 4.60.0+ (progress bars)