{"id":19961961,"url":"https://github.com/tw1ddle/markov-namegen-lib","last_synced_at":"2026-02-11T22:39:59.975Z","repository":{"id":150403920,"uuid":"438423162","full_name":"Tw1ddle/markov-namegen-lib","owner":"Tw1ddle","description":"✒️ Markov process-based procedural name and word generator library","archived":false,"fork":false,"pushed_at":"2021-12-15T22:21:34.000Z","size":447,"stargazers_count":23,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T07:46:37.730Z","etag":null,"topics":["haxe","haxelib","markov","markov-chain","markov-namegen","markov-text","name-generation","name-generator","namegen","procedural-generation","random","random-generation"],"latest_commit_sha":null,"homepage":"https://samcodes.co.uk/web/","language":"Haxe","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/Tw1ddle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2021-12-14T22:48:39.000Z","updated_at":"2024-08-17T19:32:25.000Z","dependencies_parsed_at":"2023-04-25T16:19:09.871Z","dependency_job_id":null,"html_url":"https://github.com/Tw1ddle/markov-namegen-lib","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tw1ddle%2Fmarkov-namegen-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tw1ddle%2Fmarkov-namegen-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tw1ddle%2Fmarkov-namegen-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tw1ddle%2Fmarkov-namegen-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tw1ddle","download_url":"https://codeload.github.com/Tw1ddle/markov-namegen-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241396744,"owners_count":19956404,"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":["haxe","haxelib","markov","markov-chain","markov-namegen","markov-text","name-generation","name-generator","namegen","procedural-generation","random","random-generation"],"created_at":"2024-11-13T02:09:01.920Z","updated_at":"2026-02-11T22:39:54.913Z","avatar_url":"https://github.com/Tw1ddle.png","language":"Haxe","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Markov Namegen logo](https://github.com/Tw1ddle/markov-namegen-lib/blob/master/screenshots/markovnamegen_logo.png?raw=true \"Markov Namegen Procedural Random Name Generator Project logo\")](https://www.samcodes.co.uk/project/markov-namegen/)\n\n[![License Badge](https://img.shields.io/:license-mit-blue.svg?style=flat-square)](https://github.com/Tw1ddle/markov-namegen-lib/blob/master/LICENSE)\n[![Build Status Badge](https://ci.appveyor.com/api/projects/status/github/Tw1ddle/markov-namegen-lib)](https://ci.appveyor.com/project/Tw1ddle/markov-namegen-lib)\n\nMarkov Namegen is a Markov chain-based word generator library written in Haxe, made for procedural name generation. Run the demo [here](https://www.samcodes.co.uk/project/markov-namegen/).\n\n[![Screenshot](https://github.com/Tw1ddle/MarkovNameGenerator/blob/master/screenshots/screenshot2.png?raw=true \"Markov Namegen Procedural Random Name Generator screenshot 2\")](https://www.samcodes.co.uk/project/markov-namegen/)\n\n## Features\n* Hundreds of customizable/combinable training data presets.\n* Katz backoff using high order models - look up to \"n\" characters back.\n* Sort and filter generated strings by length, start, end, content and regex matching.\n* Damerau-Levenshtein distance similarity sorting option.\n* Dirichlet prior parameter.\n\n## Usage\n\nSee the [demo code](https://github.com/Tw1ddle/MarkovNameGenerator) for a complete worked example. Also see the [library documentation](https://tw1ddle.github.io/markov-namegen-lib/).\n\n## Library Setup\n\nGet the Markov Namegen library from [GitHub](https://github.com/Tw1ddle/markov-namegen-lib) or through [haxelib](https://lib.haxe.org/p/markov-namegen/).\n\nInclude it in your ```.hxml```\n```\n-lib markov-namegen\n```\n\nOr add it to your ```Project.xml```:\n```\n\u003chaxelib name=\"markov-namegen\" /\u003e\n```\n\nYou can also transpile the library for use with different target languages by running the following from the root of the repository, and then checking the generated code in the bin folder:\n\n```\nhaxe build.hxml\n```\n\n## How It Works\n\nThe [markov-namegen haxelib](https://lib.haxe.org/p/markov-namegen) uses [Markov chains](https://en.wikipedia.org/wiki/Markov_chain) to procedurally generate original words.\n\nUsing a set of words as [training data](https://en.wikipedia.org/wiki/Machine_learning), the library calculates the conditional probability of a letter coming up after a sequence of letters chosen so far. It looks back up to \"n\" characters, where \"n\" is the order of the model.\n\nThe generator can use several orders of models, each with memory n. Starting with the highest order models (models with bigger memories), it tries to get a new character, falling back to lower order models if necessary - an approach known as [Katz's back-off model](https://en.wikipedia.org/wiki/Katz%27s_back-off_model).\n\nA [Dirichlet prior](https://en.wikipedia.org/wiki/Dirichlet_distribution#Special_cases) is used to add a constant probability that any letter may be picked as the next letter. This acts as an additive smoothing factor and adds a bit more \"randomness\" to the generated output.\n\nCountless words are generated, and are then filtered and sorted according to several tweakable criteria like length, start and end characters, [similarity to a target word](https://en.wikipedia.org/wiki/Levenshtein_distance), and so on.\n\n## Markov Namegen Ports\n\nSome users have ported and extended the Markov Namegen library to different programming languages. See:\n\n* Python - [pyMarkovNameGenerator](https://github.com/bicobus/pyMarkovNameGenerator) by [bicobus](https://github.com/bicobus).\n* C# - [ProceduralNameGenerator](https://github.com/MagicMau/ProceduralNameGenerator) by [MagicMau](https://github.com/MagicMau). \n\n## Tips\n* The generator works by using Markov chains, and requires training data to build them. A hundred or more words within your chosen category is usually sufficient for good results.\n* Sort words by similarity to preferred \"good words\" using an edit distance metric, and pick the most similar and suitable results. There are a few edit distance measures provided in EditDistanceMetrics.hx.\n* To get best results the training dataset, model order and prior will need to be tweaked for the type of words you want to generate. If possible, keep the prior parameter low or zero. Filter words to suit: look at length, beginning, end, contents, edit distance limits and regex. Some of this done for you in NameGenerator.hx. If you prefer to do it your own way, subclass the Generator class.\n\n## Notes\n* Many of the concepts used for the generator were suggested in [this article](http://www.roguebasin.com/index.php?title=Names_from_a_high_order_Markov_Process_and_a_simplified_Katz_back-off_scheme) by Jeffrey Lund.\n* The haxelib is written in plain Haxe and so supports every Haxe target.\n* If you have any questions or suggestions then [get in touch](https://twitter.com/Sam_Twidale) or open an issue.\n\n## License\n* Most of the training data bundled in the haxelib comes from sites like Wikipedia and census data sources over many years. CC-BY-SA 3.0 as a derivative from Wikipedia content will cover most of the content if you wish to use these for other purposes, but I provide no guarantee.\n* The [haxelib](https://lib.haxe.org/p/markov-namegen/) code is provided under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftw1ddle%2Fmarkov-namegen-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftw1ddle%2Fmarkov-namegen-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftw1ddle%2Fmarkov-namegen-lib/lists"}