pub struct Markov<P: Prefix = PrefixDefault>(/* private fields */);
Expand description
Markov-Chain based pronounceable word generator.
Implementations§
Source§impl<P: Prefix> Markov<P>
impl<P: Prefix> Markov<P>
Sourcepub fn new(depth: usize) -> Self
pub fn new(depth: usize) -> Self
Create new Markov-Chain with the given depth.
A Markov-Chain contains a letter frequency table for prefixes of depth codepoints. If depth is zero, then only a single table is used and the output is not context-sensitive. Higher values of depth lead to better results, but take up more memory and time to build.
pub fn load(path: &Path, depth: usize) -> Result<Self, Error>
Sourcepub fn insert(&mut self, word: &str, count: usize)
pub fn insert(&mut self, word: &str, count: usize)
Insert a word with a given weight into the table.
pub fn window(&self) -> Box<[char]>
pub fn generate( &self, rng: &mut dyn RngCore, window: &mut [char], ) -> (Option<char>, f64)
Trait Implementations§
impl<P: Prefix> StructuralPartialEq for Markov<P>
Auto Trait Implementations§
impl<P> Freeze for Markov<P>where
P: Freeze,
impl<P> RefUnwindSafe for Markov<P>where
P: RefUnwindSafe,
impl<P> Send for Markov<P>where
P: Send,
impl<P> Sync for Markov<P>where
P: Sync,
impl<P> Unpin for Markov<P>where
P: Unpin,
impl<P> UnwindSafe for Markov<P>where
P: UnwindSafe,
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