Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including titlegen with all npm packages installed. Try it out:

var titlegen = require("titlegen")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

titlegen v0.1.2

Generate plausible titles from a list of example titles.


Generate plausible titles from a list of example titles by employing a stupid-simple Markov-Chain approach.

var generator = titlegen.create();

  'You Only Live Twice',
  'From Russia with Love',
  'The Man with the Golden Gun',
  'Live and Let Die',
  'Die Another Day'

console.log(; // -> "From Russia with the Golden Gun"
console.log(; // -> "You Only Live and Let Die Another Day"
console.log(; // -> "The Man with Love"

This was originally made for generating video game titles (which is why /titles includes many lists of game titles from multiple platforms), but as the example above shows, it can also be used to generate other types of titles.



npm install titlegen


bower install titlegen

<script src="/bower_components/titlegen/titlegen.js" type="text/javascript"></script>


component install namuol/titlegen

<script src="/components/namuol-titlegen/titlegen.js" type="text/javascript"></script>


var generator = titlegen.create()

Create a new title generator.

generator.feed(['Some Title', 'Some Other Title', ...])

Reset the internal Markov-chain and feed it a list of example titles (array of strings).

Generate a new random title and return it as a string.


Integer; default is 2.

The minimum number of words a generated title can have.


Integer; default is 16.

The maximum number of words a generated title can have.


Integer; default is 20.

The maximum number of attempts titlegen will make to generate a title; titles that are too short, too long, or are duplicates of titles from the sample data are discarded.


RegExp|String; default is /(\s|'s|[:!?]\s)/

The argument passed to title.split() to divide a title up into "words".


String; default is ' '

A string used to combine words into titles.


Function; default removes spaces in front of all instances of :, !, ?, and 's.

A function that alters the title after its words have been joined with spaces.


npm install -g grunt-cli
npm install
grunt # -> titlegen.js

Included Data

A bunch of video game title lists are included in ./titles/games. These were acquired from Wikipedia.

If you'd like to add other title list examples (i.e. movies by genre, etc) add a pull request!


Code: MIT

Included Title Data: WP:CC-BY-SA

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free