Skip to main content

Module q42_lex

Module q42_lex 

Source
Expand description

Read .q42.lex reverse-lexicon sidecars (Q42LEX format from qualia-cli ingest).

Structs§

Q42LexFile
Memory-mapped .q42.lex file handle (native targets).
Q42LexMmap
Zero-allocation view over a memory-mapped .q42.lex slice (sorted hash index).
Q42Lexicon
In-memory hash → UTF-8 string map from a .q42.lex file (cold-path loader).

Enums§

LexError
LexiconEntry
Lexicon entry payload for serialization
LexiconKey
Largest UTF-8 prefix of s that fits in max_bytes, never splitting a codepoint. Zero-allocation lexicon key for in-memory lookups

Constants§

DEFAULT_LEX_PAGE_ENTRIES
Fixed upper bound used by the canonical writer. Pages are independently addressable, so an HTTP/IPFS reader only needs this many dictionary records (plus their strings) for one hash lookup.
LEX_HEADER_SIZE
LEX_MAGIC
LEX_VERSION_PAGED
PAGED_DIRECTORY_ENTRY_SIZE
PAGED_DIRECTORY_HEADER_SIZE
PAGED_PAGE_HEADER_SIZE

Functions§

serialize_paged_string_lexicon
Serialize the v2 paged Q42LEX representation.
serialize_string_lexicon
Serialize a hash → string map into the canonical Q42LEX byte layout that Q42LexMmap reads back (magic, sorted 16-byte index, tagged string blob). This is the write side of the lexicon: the RDF ingest calls it in lossless (“Complete”) mode so every subject/predicate URI and every literal is recoverable via Q42LexMmap::lookup_hash, instead of being hashed away.