@ksilvennoinen/markov-namegen
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

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.

Package Sidebar

Install

npm i @ksilvennoinen/markov-namegen

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

30.1 kB

Total Files

18

Last publish

Collaborators

  • ksilvennoinen