Sentencer

sentencer

Templating engine for madlibs-style sentence generating.

Create crazy sentences with nouns, adjectives and your own randomness!

Sentencer was written for and powers Metaphorpsum. The noun and adjective lists for form -> Word Lists for Writers.

Install it: npm install sentencer --save

Sample usage:

1
2
3
4
5
6
7
8
9
10
11
12
const Sentencer = require('sentencer');

let str = " A  jumped over ";

Sentencer.make(str); //' A agreement jumped over a sprightful'

Sentencer.make(str); // ' A shrine jumped over a wordless'

str = "  jumped over ";

Sentencer.make(str); // ' an instruction jumped over a scabrous'
Sentencer.make(str); // ' a thistle jumped over a shapely'

Define custom actions:

1
2
3
4
5
6
7
8
9
Sentencer.configure({
  actions: {
    rand: function() {
      return Math.floor( Math.random()  * 10 );
    }
  }
});

Sentencer.make("I like "); // 'I like 7'

GIF FTW:

sentencer

Thanks to @kylestetz for this fun module! (:

Suggest a module

Comments