{"id":18409615,"url":"https://github.com/portasynthinca3/markov","last_synced_at":"2025-04-07T09:34:00.391Z","repository":{"id":57521051,"uuid":"403642708","full_name":"portasynthinca3/markov","owner":"portasynthinca3","description":"Text generation library for Elixir/Erlang based on Markov chains","archived":false,"fork":false,"pushed_at":"2023-10-19T02:59:22.000Z","size":1533,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-01-27T02:42:50.792Z","etag":null,"topics":["context-awareness","elixir","erlang","markov-chain","nlp","text-generation"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/portasynthinca3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-09-06T13:58:21.000Z","updated_at":"2024-01-12T18:22:30.000Z","dependencies_parsed_at":"2023-11-25T12:42:02.450Z","dependency_job_id":null,"html_url":"https://github.com/portasynthinca3/markov","commit_stats":{"total_commits":54,"total_committers":2,"mean_commits":27.0,"dds":"0.18518518518518523","last_synced_commit":"304df4f2fd3ef0d448ad2d87bac227bbbb7f32bb"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fmarkov","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fmarkov/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fmarkov/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/portasynthinca3%2Fmarkov/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/portasynthinca3","download_url":"https://codeload.github.com/portasynthinca3/markov/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223276473,"owners_count":17118348,"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":["context-awareness","elixir","erlang","markov-chain","nlp","text-generation"],"created_at":"2024-11-06T03:26:15.377Z","updated_at":"2024-11-06T03:26:16.283Z","avatar_url":"https://github.com/portasynthinca3.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markov\n\u003cimg align=\"right\" src=\"logo/logo.png\" onerror=\"this.src = 'assets/logo.png'\"\u003e\n\nText generation library based on nth-order Markov chains\n\n![Hex.pm](https://img.shields.io/hexpm/v/markov)\n![Hex.pm](https://img.shields.io/hexpm/dw/markov)\n\n## Features\n  - **Token sanitation** (optional): ignores letter case and punctuation when switching states, but still keeps the output as-is\n  - **Operation history** (optional): recalls the operations it was instructed to perform, incl. past training data\n  - **Probability shifting** (optional): gives less frequent generation paths more chance to get used, which makes the output more original but may produce nonsense\n  - **Tagging** (optional): you can tag your source data and alter the probabilities of tagged generation paths according to your rules\n  - **Prompted generation** (optional) grants your model the ability to answer questions given to it provided that the training data consists mostly of Q\u0026A pairs\n  - **Managed disk storage** so you don't have to worry about storing and loading the models\n  - **Transparent fragmentation** reduces RAM usage and loading times with huge models\n\n## Usage\nIn `mix.exs`:\n```elixir\ndefp deps do\n  [{:markov, \"~\u003e 4.0\"}]\nend\n```\n\nUnlike Markov 1.x, this version has very strong opinions on how you should create and persist your models (that also differs from 2.x and 3.x).\n\nExample workflow (click [here](https://hexdocs.pm/markov/api-reference.html) for full docs):\n```elixir\n# The model will be stored under this path\n{:ok, model} = Markov.load(\"./model_path\", sanitize_tokens: true, store_log: [:train])\n\n# train using four strings\n:ok = Markov.train(model, \"hello, world!\")\n:ok = Markov.train(model, \"example string number two\")\n:ok = Markov.train(model, \"hello, Elixir!\")\n:ok = Markov.train(model, \"fourth string\")\n\n# generate text\n{:ok, text} = Markov.generate_text(model)\nIO.puts(text)\n\n# commit all changes and unload\nMarkov.unload(model)\n\n# these will return errors because the model is unloaded\n# Markov.generate_text(model)\n# Markov.train(model, \"hello, world!\")\n\n# load the model again\n{:ok, model} = Markov.load(\"./model_path\")\n\n# enable probability shifting and generate text\n:ok = Markov.configure(model, shift_probabilities: true)\n{:ok, text} = Markov.generate_text(model)\nIO.puts(text)\n\n# print log\nmodel |\u003e Markov.read_log |\u003e IO.inspect\n\n# this will also write our new just-set option\nMarkov.unload(model)\n```\n\n## Credits\n  - [The English dictionary in a CSV format](https://www.bragitoff.com/2016/03/english-dictionary-in-csv-format/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportasynthinca3%2Fmarkov","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fportasynthinca3%2Fmarkov","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fportasynthinca3%2Fmarkov/lists"}