Skip to content
Tracery: a story-grammar generation library for javascript
JavaScript
Branch: master
Clone or download
This branch is 31 commits ahead, 5 commits behind galaxykate:master.

Latest commit

George Buckenham
George Buckenham 2.7.4
Latest commit e6054c7 Mar 22, 2019

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
package.json
tracery.js

README.md

tracery

Tracery: a story-grammar generation library for javascript

This is my attempt to package up Tracery as a Node library.

Installation

This is hosted at npm, so it can be installed like so:

$ npm install tracery-grammar --save

Example usage

var tracery = require('tracery-grammar');

var grammar = tracery.createGrammar({
  'animal': ['panda','fox','capybara','iguana'],
  'emotion': ['sad','happy','angry','jealous'],
  'origin':['I am #emotion.a# #animal#.'],
});

grammar.addModifiers(tracery.baseEngModifiers); 

console.log(grammar.flatten('#origin#'));

Sample output:

I am a happy iguana.
I am an angry fox.
I am a sad capybara.
You can’t perform that action at this time.