Skip to content

kari/markov-namegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

markov-namegen

This is a TypeScript port of markov-namegen-lib. It is a Markov chain based name or word generator library.

Features

Offers most of the features available in the reference Haxe implementation

  • A simplified Katz back-off using high order models - look up to "n" characters back.
  • Sort and filter generated strings by length, start, end, and content.
  • Dirichlet prior parameter.

Usage

const data = ["lots", "of", "words", "to", "learn", "from"];
const namegen = new NameGenerator(data, 3, 0, false);
console.log(namegen.generate(5, 11, "", "", "", ""));

or if you want to generate a lot of names in one go

console.log(namegen.generateNames(20, 5, 11, "", "", "", ""))

For training data and word lists, see the original project's word_lists folder.

Notes

  • The original Haxe implementation can target Javascript, so both of these can ultimately compile/transpile down to that. So if you are just looking for a JavaScript implementation, you might want to use the original instead.

License

Distributed under the MIT License. See LICENSE for more information.