adamisntdead / markov-chains

Markov Chains Implemented in Rust

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Markov Chains

An implementation of text based markov chains in Rust.

The main use of this is for the generation of text, and thus is not expandable for other uses. If you do need a more geeric implementation / library, please see the markov or markov-chain crates.

Example

fn main() {
    let tokens = include_str!("../input.txt")
        .split_whitespace()
        .map(|x| String::from(x))
        .collect();

    let cache = create_cache(tokens);
    let text = generate_text(cache, 500);
    println!("{}", text);
}

Please note that this library is not available as a crate as of yet, due to the non generic nature of the library.

This may or may not be changed in the near future.

License

MIT.

About

Markov Chains Implemented in Rust


Languages

Language:Rust 100.0%