https://github.com/adamisntdead/markov-chains
Markov Chains Implemented in Rust
https://github.com/adamisntdead/markov-chains
markov markov-chain markov-text rust
Last synced: 11 months ago
JSON representation
Markov Chains Implemented in Rust
- Host: GitHub
- URL: https://github.com/adamisntdead/markov-chains
- Owner: adamisntdead
- Created: 2018-05-20T20:07:34.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-20T20:07:51.000Z (about 8 years ago)
- Last Synced: 2025-07-08T09:53:51.479Z (about 1 year ago)
- Topics: markov, markov-chain, markov-text, rust
- Language: Rust
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Markov Chains
> An implementation of text based [markov chains](https://en.wikipedia.org/wiki/Markov_chain) 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](https://crates.io/crates/markov) or [markov-chain](https://crates.io/crates/markov-chain) crates.
## Example
```rust
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.