<commit_before># markov [![Build Status](https://travis-ci.org/aatxe/markov.svg?branch=master)](https://travis-ci.org/aatxe/markov) [![Crates.io](https://img.shields.io/crates/v/markov.svg)](https://crates.io/crates/markov) #

A generic implementation of a [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) in Rust. 
Documentation can be found online [here](http://www.rust-ci.org/aatxe/markov/doc/markov/).

## Examples ##

With Strings: 
```rust
extern crate markov;

use markov::Chain;

fn main() {
    let mut chain = Chain::for_strings();
    chain.feed_str("I like cats and I like dogs.");
    println!("{}", chain.generate_str());
}
```

With integers:
```rust
extern crate markov;

use markov::Chain;

fn main() {
    let mut chain = Chain::new(0u8, 255);
    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::for_strings();<commit_msg>Remove user-provided terminals from README examples<commit_after># markov [![Build Status](https://travis-ci.org/aatxe/markov.svg?branch=master)](https://travis-ci.org/aatxe/markov) [![Crates.io](https://img.shields.io/crates/v/markov.svg)](https://crates.io/crates/markov) #

A generic implementation of a [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) in Rust. 
Documentation can be found online [here](http://www.rust-ci.org/aatxe/markov/doc/markov/).

## Examples ##

With Strings: 
```rust
extern crate markov;

use markov::Chain;

fn main() {
    let mut chain = Chain::new();
    chain.feed_str("I like cats and I like dogs.");
    println!("{}", chain.generate_str());
}
```

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();
{'fraction_non_alphanumeric': 0.19083969465648856, 'fraction_numerical': 0.01097328244274809, 'mean_word_length': 4.432642487046632, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4950368', 'n_tokens_mistral': 788, 'n_tokens_neox': 754, 'n_words': 175}