Expand description
Core interfaces of the Kannaka Universal Tokenization Engine.
Nothing here knows about a particular algorithm or data format. Algorithms
implement Tokenizer, formats implement ModalityAdapter, and both are
added to a Registry at run time, so third parties extend KUTE without
changing this crate (FR-002, ADR-0003).
Re-exports§
pub use kute_types as types;
Structs§
- Adapter
Capabilities - What an adapter declares about itself.
- Corpus
Fingerprint - Order-sensitive fingerprint of a corpus as a tokenizer sees it. Trainers feed every record through this and store the result as provenance.
- FnCorpus
- A corpus backed by a closure, for streaming sources.
- Registry
- Run-time table of algorithms and adapters.
- VecCorpus
- An in-memory corpus.
Enums§
- Representation
- A numeric representation of one token (FR-015).
Traits§
- Corpus
Source - A stream of canonical records to train on.
- Modality
Adapter - Converts raw bytes of some format to canonical input and back (PRD 9.3).
- Representation
Backend - Maps token ids to another representation. Mappings are versioned on their own and never change what a token id means (FR-015, ADR-0011).
- Tokenizer
- The generic tokenizer interface (PRD 9.3).
Functions§
- check_
sequence - Check that a token sequence was produced by exactly this vocabulary.
- decoded_
bytes_ at_ least - A lower bound on the bytes
tokensdecodes to. For a byte vocabulary it is the decoded length. For a symbol vocabulary it is the total length of the symbol names, before the adapter writes them out, which only adds to it. A symbol may be up to 1024 bytes long, so the number of symbols (decoded_units) says little about the bytes; this does. - decoded_
units - How many units (bytes or symbols)
tokensdecodes to, computed from the token table without decoding. A five-byte id can stand for a 64 KiB token, so callers that decode untrusted sequences check this against a budget first. - sequence_
for - Build the sequence header for
vocabulary.