march

Crates.iomarch
lib.rsmarch
version0.1.0
sourcesrc
created_at2023-05-10 00:06:42.365572
updated_at2023-05-10 00:06:42.365572
descriptionA Markov chain implementation
homepage
repositoryhttps://github.com/kotx/march.git
max_upload_size
id860927
size16,165
Kot C (kotx)

documentation

README

March

A Markov chain crate for Rust. This implementation should work for any item that implements Hash + Eq + Clone.

Usage

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.

Commit count: 3

cargo fmt