Home

Awesome

Markov Namegen logo

License Badge Build Status Badge

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

Screenshot

Features

Usage

See the demo code for a complete worked example. Also see the library documentation.

Library Setup

Get the Markov Namegen library from GitHub or through haxelib.

Include it in your .hxml

-lib markov-namegen

Or add it to your Project.xml:

<haxelib name="markov-namegen" />

You 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:

haxe build.hxml

How It Works

The markov-namegen haxelib uses Markov chains to procedurally generate original words.

Using a set of words as training data, 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.

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

A Dirichlet prior 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.

Countless 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, and so on.

Markov Namegen Ports

Some users have ported and extended the Markov Namegen library to different programming languages. See:

Tips

Notes

License