Crates.io | march |
lib.rs | march |
version | 0.1.0 |
source | src |
created_at | 2023-05-10 00:06:42.365572 |
updated_at | 2023-05-10 00:06:42.365572 |
description | A Markov chain implementation |
homepage | |
repository | https://github.com/kotx/march.git |
max_upload_size | |
id | 860927 |
size | 16,165 |
A Markov chain crate for Rust.
This implementation should work for any item that implements Hash
+ Eq
+ Clone
.
use march::Chain;
fn main() {
let mut chain = Chain::new();
let sentence = "The quick brown fox jumped over the lazy dog".to_lowercase();
let mut words = sentence.split_whitespace().into_iter();
chain.feed(&mut words);
let sentence = chain.generate();
dbg!(sentence);
}
See examples for more usages.