pub struct Model { /* private fields */ }
Expand description
Symbol table for the encoder/decoder. Used to store the probabilities as a vector of counts (number of occurrences). Uniform would be every symbol has a count of 0.
Implementations
sourceimpl Model
impl Model
pub fn builder() -> Builder
sourcepub fn from_values(
counts: Vec<u32>,
fenwick_counts: Vec<u32>,
total_count: u32,
eof: u32
) -> Self
pub fn from_values(
counts: Vec<u32>,
fenwick_counts: Vec<u32>,
total_count: u32,
eof: u32
) -> Self
For loading a saved model. Use the
Builder
for
more options.
pub fn update_symbol(&mut self, symbol: u32)
pub const fn num_symbols(&self) -> u32
pub fn high(&self, index: u32) -> f64
pub fn low(&self, index: u32) -> f64
pub fn probability(&self, symbol: u32) -> (f64, f64)
pub const fn eof(&self) -> u32
pub const fn counts(&self) -> &Vec<u32>
pub const fn fenwick_counts(&self) -> &Vec<u32>
pub const fn total_count(&self) -> u32
Auto Trait Implementations
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more