{"id":13507872,"url":"https://github.com/eljojo/ex_chain","last_synced_at":"2025-03-30T09:33:11.124Z","repository":{"id":146749348,"uuid":"58758491","full_name":"eljojo/ex_chain","owner":"eljojo","description":"Simple Markov Chain written in Elixir","archived":true,"fork":false,"pushed_at":"2016-05-19T02:46:34.000Z","size":13,"stargazers_count":20,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T05:11:58.544Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eljojo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-13T17:09:34.000Z","updated_at":"2025-01-11T17:22:13.000Z","dependencies_parsed_at":"2024-01-05T21:54:59.332Z","dependency_job_id":"8ece5db3-57f0-4e15-9330-d0cb1c84cea5","html_url":"https://github.com/eljojo/ex_chain","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/eljojo%2Fex_chain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljojo%2Fex_chain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljojo%2Fex_chain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eljojo%2Fex_chain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eljojo","download_url":"https://codeload.github.com/eljojo/ex_chain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301963,"owners_count":20755512,"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-08-01T02:00:41.778Z","updated_at":"2025-03-30T09:33:10.839Z","avatar_url":"https://github.com/eljojo.png","language":"Elixir","funding_links":[],"categories":["Examples and funny stuff"],"sub_categories":[],"readme":"# ExChain\n\nVery simple Markov Chain written in Elixir. This is my toy-project, so I can learn Elixir.\n\nIf you have experience with Elixir and find improvements, please let me know, or simply write a comment in the appropiate line. All suggestions are more than welcome.\n\nIt's mostly based in the [Markov Models in Ruby](https://docs.omniref.com/github/omniref/hn_title_generator/0.1.0/symbols/HNTitleGenerator::MarkovModel#line=11) tutorial.\n\nThe Markov Model creates funny messages based on tweets downloaded from your Twitter Archive.\n\nIt generates messages [like this](https://twitter.com/eljojo/status/730268186369646592).\n\n## How to run this?\n\nThe first thing you need is Elixir. If you have a Mac, you can install it using ``brew install elixir``.\n\nThis program needs your twitter archive, so go ahead and dowload it from your settings in twitter.com.\n\nDownload the repository with ``git clone git@github.com:eljojo/ex_chain.git``.\nExtract your twitter archive, and put the contents of the ``data/js/tweets`` folder into ``ex_chain/data``.\n\n```\n$ cd ex_chain\n$ mix deps.get # get the dependencies using mix, Elixir's rake. Analog to bundle install.\n$ iex -S mix # analog to irb or rails console\n```\n\nInside iex, you can generate new messages by typing:\n\n```elixir\niex(1)\u003e {:ok, model} = ExChain.MarkovModel.start_link\n{:ok, #PID\u003c0.126.0\u003e}\niex(2)\u003e ExChain.MarkovModel.populate_model(model, ExChain.FileDatasource.get_data)\n{:ok}\niex(3)\u003e ExChain.SentenceGenerator.create_filtered_sentence(model)\n{:ok, \"I'm not a Food Social Network?\", 0.4668037713169559, 4}\niex(4)\u003e ExChain.SentenceGenerator.create_filtered_sentence(model)\n{:ok, \"I am in churros.\", 0.30839889769910056, 2}\niex(5)\u003e ExChain.SentenceGenerator.create_filtered_sentence(model)\n{:ok, \"I'm never sleeping again.\", 0.3546596799639396, 14}\niex(6)\u003e ExChain.SentenceGenerator.create_sentence(model)\n{\"future: scumbag apple: makes you release the happiness hormone.\",\n 0.8334241103848947}\niex(7)\u003e ExChain.SentenceGenerator.complete_sentence(model, \"i love\")\n{\"i love the smell of shipping technical debt\", 0.6685185185185185}\n```\n\n## Where's the code?\n\nThe meat and potatos are located in just three files:\n\n| File                               | what it does                                                       |\n|------------------------------------|--------------------------------------------------------------------|\n| lib/ex_chain/file_datasource.ex    | This file parses the tweets located in the data folder.            |\n| lib/ex_chain/markov_model.ex       | This file is in charge of holding the state of the \"Markov Model\". |\n| lib/ex_chain/sentence_generator.ex | This file generates the sentences using the Markov Model.          |\n\n### CLI\n\nExChain also has a CLI interface.\nTo use it, you first need to compile the application into an escript (Erlang VM) binary.\n\n```\n$ mix escript.build\n$ ./ex_chain generate_sentence\nI think currywurst is the best time to wake up.\n```\n\n## Suggestions\n\nPlease send me all your suggestions to [@eljojo](https://twitter.com/eljojo) or directly to my email jojo at eljojo dot net.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feljojo%2Fex_chain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feljojo%2Fex_chain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feljojo%2Fex_chain/lists"}