pub trait TrieArray {
    fn build(token_ids: Vec<usize>, pointers: Vec<usize>) -> Box<Self>;
fn serialize_into<W: Write>(&self, writer: W) -> Result<usize>;
fn deserialize_from<R: Read>(reader: R) -> Result<Box<Self>>;
fn size_in_bytes(&self) -> usize;
fn memory_statistics(&self) -> Value;
fn token_id(&self, i: usize) -> usize;
fn range(&self, pos: usize) -> (usize, usize);
fn find_token(&self, pos: usize, id: usize) -> Option<usize>;
fn num_tokens(&self) -> usize;
fn num_pointers(&self) -> usize; }
Expand description

Trait for a data structure for sorted arrays of each trie level.

Required methods

Builds a TrieArray from sequences of token ids and pointers.

Serializes the data structure into the writer.

Deserializes the data structure from the reader.

Gets the number of bytes to serialize the data structure.

Gets breakdowns of memory usages for components.

Gets the i-th token id.

Gets the range pointers[pos]..pointers[pos+1].

Finds the position i such that token_id(i) = id and i in range(pos).

Gets the number of tokens stored.

Gets the number of pointers stored.

Implementors