Procedural word generation tool using a high order Markov process, back-off scheme, filtering and sorting

To install, run:

haxelib install markov-namegen 1.0.5 

See using Haxelib in Haxelib documentation for more information.

Markov Namegen

Markov Namegen is a Markov chain-based word generator written in Haxe, made for procedural name generation. Try the demo out here.


  • Katz backoff using "high order" models - look up to "n" characters back.
  • Sort and filter generated strings by length, start, end, content and regex matching.
  • Damerau-Levenshtein distance sort method.
  • Dirichlet prior parameter.


See the demo code for a complete worked example. Also read the documentation here.


  • 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.
  • 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.
  • 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.


  • Many of the concepts used for the generator were suggested in this article by Jeffrey Lund.
  • The haxelib supports every Haxe target.
  • If you have any questions or suggestions then get in touch or open an issue.
2 weeks ago

All libraries are free

Every month, more than thousand developers use haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser!

Join us on Github!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on Github