Browse documentation
DocsStart
Choose an API
Pick an API based on how you need to consume data, not just the input format.
01
The decision table
| Need | Use | Result |
|---|---|---|
| Random access, editing, or repeated passes | lokit.parse.<format>() | BaseStructure |
| One bounded pass with document metadata | lokit.stream.<format>() | StreamingStructure |
| Async consumption without blocking the event loop | lokit.parse.async_.<format>() | Async iterator of (unit_id, Data) |
| Querying, navigation, and in-memory matching | lokit.Lokit.parse() | Lokit facade |
| Direct path-to-path conversion | lokit.convert.<source>_to_<target>() | Written output file |
| Flat interchange rows | parse.to_dict or stream.to_dict | List or lazy row iterator |
02
Async parsers are iterated, not awaited
Async parse and stream functions return async iterators. Iterate them directly. The async writer functions are coroutines and are awaited.
async_pipeline.py
import lokit
async def copy_tmx() -> None: async for unit_id, unit in lokit.parse.async_.tmx("messages.tmx"): print(unit_id, unit.source)
document = lokit.parse.tmx("messages.tmx") await lokit.export.async_.xliff(document, "messages.xliff")03
Streaming availability is intentionally narrower
Synchronous document streams are available for .lokit, TMX, XLIFF, DOCX, and PPTX. CSV, XLSX, PO, JSON i18n, HTML, and IDML are available as materialized parsers and async unit iterators. stream.to_dict() and stream.write_jsonl() are projection/output helpers rather than document parsers.