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.
uv run pytest # the whole suite
uv run pytest tests/test_engine.py # one file
uv run pytest --require-artifacts # fail, don't skip, on a missing artifact
uv run pytest -m "e2e and not live" # build the wheel and exercise itWeights and lookup tables are gitignored, so a fresh clone skips what needs
them and prints the build command in the terminal summary. --require-artifacts
turns those skips into failures; CI runs one leg that way. Do not use
python -m unittest — it collects roughly half the suite and errors.
uv sync # Install dependencies with uv (recommended)
uv build # Build package
pip install -e . # Install in development mode (alternative)# Modern Click-based CLI
indicate transliterate "राजशेखर चिंतालपति"
indicate transliterate --input file.txt --output result.txt --engine lookup,model
indicate languages
indicate infocd docs/ && uv run --group docs sphinx-build -W -b html . _build/html- Seq2SeqModel (
indicate/transliterator.py) - one instance per language pair, built bymodel_for(pair)and cached in_MODELS; holds the vocab/weights paths and max lengths as instance state. torch is imported insideload(), not at module scope, so a run that never decodes never pays for it.clear_models()drops the cache. - Pair registry (
indicate/languages.py) - languages, aliases, scripts, and the(source, target)pairs a local model exists for. Replaces the old class-per-language modules. - Backends (
indicate/engine.py) -lookup/model/llmbehind aBackendprotocol, folded in order byresolve_words; each returns a candidate list per word orNoneto decline. - 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:
indicate transliterate(pluslanguages,info);--from/--to/--engine - API:
indicate.transliterate(text, source=..., engine=[...])andtransliterate_batch - Backends:
indicate/engine.py(lookup,model,llm), chained in order; first to answer wins
- 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)
- huggingface-hub 0.23+ (lazy weight download at first use)
- litellm 1.0+ (the
llmbackend; imported lazily, it costs ~1.3s) - tqdm 4.60.0+ (progress bars)