{"id":18113514,"url":"https://github.com/ix/rust-markov-text","last_synced_at":"2025-04-06T09:11:55.598Z","repository":{"id":89766575,"uuid":"60132298","full_name":"ix/rust-markov-text","owner":"ix","description":"Markov text library for Rust.","archived":false,"fork":false,"pushed_at":"2016-08-29T22:33:38.000Z","size":1291,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-12T14:28:05.622Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-01T00:15:22.000Z","updated_at":"2023-06-05T15:32:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"29fd9669-271f-49f3-b3f3-9f5543d11372","html_url":"https://github.com/ix/rust-markov-text","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ix%2Frust-markov-text","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ix%2Frust-markov-text/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ix%2Frust-markov-text/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ix%2Frust-markov-text/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ix","download_url":"https://codeload.github.com/ix/rust-markov-text/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457803,"owners_count":20941906,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-01T02:09:03.123Z","updated_at":"2025-04-06T09:11:53.953Z","avatar_url":"https://github.com/ix.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markov-text\nA crate for Markov text generation.\n\nExample:\n\n```rust\nextern crate markov_text;\n\nuse markov_text::{Dictionary, Sentence};\nuse std::fs::File;\nuse std::io::prelude::*;\n\nfn main() {\n  let mut markov = Dictionary::new();\n  let mut file = File::open(\"example\").expect(\"Couldn't open `example` file.\");\n  let mut buf = String::new();\n\n  file.read_to_string(\u0026mut buf).expect(\"Failed to read the file!\");\n  markov.parse(Sentence::from(\u0026*buf)).unwrap();\n\n  let prefix = markov.rand_prefix().expect(\"Failed to get a prefix!\"); {\n    println!(\"{}\", markov.generate(\u0026prefix, 60).unwrap());\n  }\n}\n```\n\nOr, once you've created a dictionary and parsed some text to it, you can generate from your own \"prefix\", that is, two words (though this may be configurable in the future) as so:\n\n```rust\nlet prefix = (\"the\".into(), \"game\".into()); {\n  println!(\"{}\", markov.generate(\u0026prefix, 60).unwrap());\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fix%2Frust-markov-text","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fix%2Frust-markov-text","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fix%2Frust-markov-text/lists"}