npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

titlegen

v0.1.2

Published

Generate plausible titles from a list of example titles.

Downloads

37

Readme

titlegen

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

var generator = titlegen.create();

generator.feed([
  'You Only Live Twice',
  'From Russia with Love',
  'The Man with the Golden Gun',
  'Live and Let Die',
  'Die Another Day'
]);

console.log(generator.next()); // -> "From Russia with the Golden Gun"
console.log(generator.next()); // -> "You Only Live and Let Die Another Day"
console.log(generator.next()); // -> "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.

Installing

node.js

npm install titlegen

bower

bower install titlegen

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

component

component install namuol/titlegen

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

API

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

generator.next()

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

generator.config.min_word_count

Integer; default is 2.

The minimum number of words a generated title can have.

generator.config.max_word_count

Integer; default is 16.

The maximum number of words a generated title can have.

generator.config.max_attempts

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.

generator.config.splitter

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

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

generator.config.joiner

String; default is ' '

A string used to combine words into titles.

generator.config.transform

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.

Building

npm install -g grunt-cli
npm install
grunt # titlegen.coffee -> 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!

Licenses

Code: MIT

Included Title Data: WP:CC-BY-SA