1 unstable release

Uses old Rust 2015

0.1.0 Sep 22, 2020

#28 in #weighted


Used in warkov-wordgen

AGPL-3.0+

12KB
241 lines

warkov

A weighted link:markov chain in rust. This project contains the base library and command line programmes to generate things from other things.

warkov

This is the library for generating things with Markov Chains, and can be used by other programmes. See link:target/doc/warkov/index.html[the API documentation].

warkov-wordgen

Generate words from a text file of existing entries. See link:warkov-wordgen/README.adoc[it's README].

All copyrighted, and licenced under the GNU Affero GPL v3 (or later), see link:LICENCE[]


lib.rs:

Markov chain generator

Documenation

Look a head size

When generating a new term, it looks at the previous X items that it has already output to decide the next item. This number controls this.

Example

use warkov::MarkovChain;

// Create a new generator
let mut mc = MarkovChain::new(5);

// Train it on some words
mc.train("foo".chars());
mc.train("bar".chars());
mc.train("baz".chars());

// Generate a new word
let new_word: Vec<char> = mc.generate();

Dependencies

~385KB