| Crates.io | hat-splitter |
| lib.rs | hat-splitter |
| version | 0.1.10 |
| created_at | 2025-04-07 15:08:29.077981+00 |
| updated_at | 2025-04-24 16:50:19.91295+00 |
| description | HAT splitter |
| homepage | |
| repository | https://github.com/Aleph-Alpha/hat-splitter |
| max_upload_size | |
| id | 1624341 |
| size | 23,350 |
The hat-splitter crate implements the splitting rule described in the
Hierarchical Autoregressive Transformers
paper. You can use this to implement
training and inference of HAT models.
cargo add hat-splitter
use hat_splitter::{HATSplitter, Splitter};
let my_hat_splitter = HATSplitter::new();
let words: Vec<String> = my_hat_splitter.split("Hello, world!");
assert_eq!(words, vec!["Hello,", " world!"]);
let words: Vec<Vec<u8>> = my_hat_splitter.split_with_limit("Hello, world!", 4);
assert_eq!(words, vec![b"Hell".to_vec(), b"o,".to_vec(), b" wor".to_vec(), b"ld!".to_vec()]);