pub struct Chain { /* private fields */ }
Expand description
A Markov chain.
Implementations§
Source§impl Chain
impl Chain
pub fn new(order: usize) -> Self
pub fn train(&mut self, string: &str)
pub fn generate(&self) -> Option<String>
Sourcepub fn generate_from_seed(&self, seed: &ChainKey) -> Option<String>
pub fn generate_from_seed(&self, seed: &ChainKey) -> Option<String>
Generate a string based on some seed words.
Returns None
if there is no way to start a generated string with
that seed, eg. it is longer than self.order
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chain
impl RefUnwindSafe for Chain
impl Send for Chain
impl Sync for Chain
impl Unpin for Chain
impl UnwindSafe for Chain
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more