Glossary
AppError
The central error enum defined in src/error.rs. All fallible operations in the application return Result<T, AppError>.
AsyncGlobalBackoffState The struct that tracks failure streaks and computes jittered exponential backoff delays between API retries.
Bbox Bounding box — a rectangle expressed in PDF page coordinates (x, y, width, height) that describes where a piece of text is positioned on a page. Used by the PDF parser and reconstructor.
CacheKey
A composite key of (text, src_lang, tgt_lang) used to look up previously translated sentences in TranslationService’s internal cache.
Cli
The struct derived by clap from raw command-line arguments. It is the unvalidated precursor to RuntimeConfig.
Danda (।)
The Devanagari sentence-ending punctuation mark, equivalent to a full stop in Latin scripts. TMT’s sentence splitter recognises it as a sentence boundary.
formats::translate_file
The top-level dispatch function in src/formats/mod.rs. It inspects the input file extension and routes execution to the correct format handler.
RuntimeConfig
The validated configuration struct produced by RuntimeConfig::try_from(&cli). It is the single source of truth for the application’s runtime state and is passed to every subsystem.
Semaphore
A tokio::sync::Semaphore used by TranslationService to cap the number of concurrent in-flight API requests to the value specified by --concurrency.
split_sentences
The function in src/translate/sentence.rs that divides a text string into sentence fragments on ., !, ?, and ।.
TextBlock
A struct produced by the PDF parser that pairs a Bbox with the extracted text string for one text-drawing operator on a PDF page.
TMT API
The external HTTP translation service provided by Kathmandu University’s ILPRL lab, accessible at https://tmt.ilprl.ku.edu.np/lang-translate. TMT the CLI tool is a client for this API.
TmtClient
The low-level HTTP client in src/tmt/mod.rs that sends TmtRequest objects to the TMT API and parses TmtResponse objects back.
TranslationService
The high-level orchestration layer in src/translate/service.rs. It wraps TmtClient and adds sentence splitting, caching, deduplication, and concurrency control.