[−][src]Struct warkov::MarkovChain
A Markov Chain.
Implementations
impl<T> MarkovChain<T, ThreadRng> where
T: Hash + Eq + Clone + Default + Ord + Debug,
[src]
T: Hash + Eq + Clone + Default + Ord + Debug,
pub fn new(size: usize) -> Self
[src]
Creates a MarkovChain with the max look a head size. Uses the stock thread local random number generator
Panics
If size is 0.
impl<T, R> MarkovChain<T, R> where
T: Hash + Eq + Clone + Default + Ord + Debug,
R: Rng,
[src]
T: Hash + Eq + Clone + Default + Ord + Debug,
R: Rng,
pub fn new_with_rng(size: usize, rng: R) -> Self
[src]
Creates a MarkovChain with the specified random number generator, and max look a head size
Panics
If size is 0.
pub fn set_rng(&mut self, rng: R)
[src]
Change the random number generation for this object to rng
.
pub fn train(&mut self, term: impl Iterator<Item = T>)
[src]
Teach the markov chain this term
.
pub fn generate(&mut self) -> Vec<T>
[src]
Generates a term. Uses the lookbehind value this was created with.
pub fn generate_max_look(&mut self, max_lookbehind: usize) -> Vec<T>
[src]
Generates a new term with a custom lookbehind.
Panics
If max_lookbehind
is 0 or greater than the lookbehind this was created with.
Trait Implementations
impl<T: Default, R: Default> Default for MarkovChain<T, R> where
T: Hash + Eq + Clone + Default + Ord + Debug,
R: Rng,
[src]
T: Hash + Eq + Clone + Default + Ord + Debug,
R: Rng,
fn default() -> MarkovChain<T, R>
[src]
Auto Trait Implementations
impl<T, R> RefUnwindSafe for MarkovChain<T, R> where
R: RefUnwindSafe,
T: RefUnwindSafe,
R: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, R> Send for MarkovChain<T, R> where
R: Send,
T: Send,
R: Send,
T: Send,
impl<T, R> Sync for MarkovChain<T, R> where
R: Sync,
T: Sync,
R: Sync,
T: Sync,
impl<T, R> Unpin for MarkovChain<T, R> where
R: Unpin,
T: Unpin,
R: Unpin,
T: Unpin,
impl<T, R> UnwindSafe for MarkovChain<T, R> where
R: UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
R: UnwindSafe,
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,