| Crates.io | marukov |
| lib.rs | marukov |
| version | 0.0.2 |
| created_at | 2025-09-18 21:38:08.568689+00 |
| updated_at | 2025-12-21 06:45:19.328835+00 |
| description | a simple markov chain text generator |
| homepage | https://github.com/xjunko/marukov |
| repository | https://github.com/xjunko/marukov |
| max_upload_size | |
| id | 1845443 |
| size | 22,936 |
a very simple markov-chain related library, mostly used for text generations but can be applied to anything else.
Chain can be re-used in other applications, refer to [here].Text generations are done with GPT-like tokenizer, which speds things up significantly.use marukov::{Text, TextOptions};
// load your data from somewhere
// each new line in your data is a new entry.
let lyrics = std::fs::read_to_string("weathergirl.txt").unwrap();
// create the text model
let text = Text::new(lyrics);
// start generating stuff
for _ in 0..5 {
if let Some(res) = text.generate(TextOptions::default()) {
println("{}", res);
}
}
// or if you want to generate starting from a word
for _ in 0..5 {
if let Some(res) = text.generate_with_start("uma", TextOptions::default()) {
println("{}", res);
}
}
uma musume fans when your take a visit to uniqlo
ability so specific it sounds so stupid
asriel dreemurr from touhou 93
banished back to middle east
chemistry is applied philosophy
razorback and danger shield is just really bad
completely new sentence btw, you just have to give it a lot of data.
this package is loosely based off the @jsvine/markovify library.