Skip to main content

Crate kute_core

Crate kute_core 

Source
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§

AdapterCapabilities
What an adapter declares about itself.
CorpusFingerprint
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§

CorpusSource
A stream of canonical records to train on.
ModalityAdapter
Converts raw bytes of some format to canonical input and back (PRD 9.3).
RepresentationBackend
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 tokens decodes 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) tokens decodes 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.