A generic implementation of a Markov chain in Rust. Documentation can be found online here.
With Strings: ```rust extern crate markov;
use markov::Chain;
fn main() { let mut chain = Chain::new(); chain.feedstr("I like cats and I like dogs."); println!("{}", chain.generatestr()); } ```
With integers: ```rust extern crate markov;
use markov::Chain;
fn main() { let mut chain = Chain::new(); chain.feed(vec![1u8, 2, 3, 5]).feed(vec![3u8, 9, 2]); println!("{}", chain.generate()); } ```
Chains have iterators (both infinite and sized!): ```rust extern crate markov;
use markov::Chain;
fn main() { let mut chain = Chain::new(); chain.feedstr("I like cats and I like dogs."); for line in chain.iterfor(5) { println!("{}", line); } } ```
Contributions to this library would be immensely appreciated. It should be noted that as this is a public domain project, any contributions will thus be released into the public domain as well.