{"id":17319999,"url":"https://github.com/aatxe/markov","last_synced_at":"2025-04-05T09:10:29.272Z","repository":{"id":24306875,"uuid":"27702569","full_name":"aatxe/markov","owner":"aatxe","description":"A generic markov chain implementation in Rust.","archived":false,"fork":false,"pushed_at":"2024-07-19T14:14:40.000Z","size":1507,"stargazers_count":90,"open_issues_count":4,"forks_count":33,"subscribers_count":5,"default_branch":"stable","last_synced_at":"2025-03-29T08:11:14.947Z","etag":null,"topics":["markov","markov-chain","nth-order","probabilistic-functions","text-generation"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aatxe.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":"2014-12-08T07:12:45.000Z","updated_at":"2025-01-01T17:08:27.000Z","dependencies_parsed_at":"2024-06-21T14:18:21.809Z","dependency_job_id":"cee77bce-6813-472b-abb5-0952ec170763","html_url":"https://github.com/aatxe/markov","commit_stats":{"total_commits":162,"total_committers":12,"mean_commits":13.5,"dds":0.308641975308642,"last_synced_commit":"90a3fee957ee5889cdbe8007e79c8a26058c9dc3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatxe%2Fmarkov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatxe%2Fmarkov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatxe%2Fmarkov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aatxe%2Fmarkov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aatxe","download_url":"https://codeload.github.com/aatxe/markov/tar.gz/refs/heads/stable","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312085,"owners_count":20918344,"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":["markov","markov-chain","nth-order","probabilistic-functions","text-generation"],"created_at":"2024-10-15T13:28:27.178Z","updated_at":"2025-04-05T09:10:29.230Z","avatar_url":"https://github.com/aatxe.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# markov [![Build Status][ci-badge]][ci] [![Crates.io][cr-badge]][cr] [![Docs][doc-badge]][doc] [![Built with Spacemacs][bws]][sm]\n\n[ci-badge]: https://travis-ci.org/aatxe/markov.svg\n[ci]: https://travis-ci.org/aatxe/markov\n[cr-badge]: https://img.shields.io/crates/v/markov.svg\n[cr]: https://crates.io/crates/markov\n[doc-badge]: https://docs.rs/markov/badge.svg\n[doc]: https://docs.rs/markov\n[bws]: https://cdn.rawgit.com/syl20bnr/spacemacs/442d025779da2f62fc86c2082703697714db6514/assets/spacemacs-badge.svg\n[sm]: http://spacemacs.org\n\nA generic implementation of a [Markov chain](https://en.wikipedia.org/wiki/Markov_chain) in Rust. It\nsupports all types that implement `Eq`, `Hash`, and `Clone`, and has some specific helpers for\nworking with `String` as text generation is the most likely use case. You can find up-to-date,\nready-to-use documentation online [on docs.rs][doc].\n\n__Note__: `markov` is in passive maintenance mode. It should work well for its intended use case\n(largely textual generation, especially in chat bots and the like), but will likely not grow to any\nfurther use cases. If it does not meet your needs in a broad sense, you should likely fork it or\ndevelop a more purpose-built library. Nevertheless, bug reports will still be triaged and fixed.\n\n## Examples ##\n\nWith Strings: \n```rust,no_run\nextern crate markov;\n\nuse markov::Chain;\n\nfn main() {\n    let mut chain = Chain::new();\n    chain.feed_str(\"I like cats and I like dogs.\");\n    println!(\"{:?}\", chain.generate_str());\n}\n```\n\nWith integers:\n```rust,no_run\nextern crate markov;\n\nuse markov::Chain;\n\nfn main() {\n    let mut chain = Chain::new();\n    chain.feed(vec![1u8, 2, 3, 5]).feed([3u8, 9, 2]);\n    println!(\"{:?}\", chain.generate());\n}\n```\n\nChains have iterators (both infinite and sized!):\n```rust,no_run\nextern crate markov;\n\nuse markov::Chain;\n\nfn main() {\n    let mut chain = Chain::new();\n    chain.feed_str(\"I like cats and I like dogs.\");\n    for line in chain.iter_for(5) {\n        println!(\"{:?}\", line);\n    }\n}\n```\n\nChains can be higher-order:\n```rust,no_run\nextern crate markov;\n\nuse markov::Chain;\n\nfn main() {\n    let mut chain = Chain::of_order(2);\n    chain.feed_str(\"I like cats and I like dogs.\");\n    for line in chain.iter_for(5) {\n        println!(\"{:?}\", line);\n    }\n}\n```\n\n## Contributing ##\nContributions to this library would be immensely appreciated. It should be noted that as this is a\npublic domain project, any contributions will thus be released into the public domain as well.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faatxe%2Fmarkov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faatxe%2Fmarkov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faatxe%2Fmarkov/lists"}