• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    JavaScript
  • Created almost 10 years ago
  • Updated about 8 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Procedurally generate text with JavaScript

Rantjs

Rantjs is a procedural text generator. The goal is to augment human creativity with the boundless potential of randomness. Inspired by Rant.

The project is available via npm (do npm install rantjs).

Demo and more information

Interactive demo available here

Click here for a writeup on my blog

Usage

var rant = require("rantjs");
var sentence=rant('<firstname male> likes to <verb-transitive> <noun.plural> with <pron poss male> pet <noun-animal> on <timenoun dayofweek plural>.');

console.log(sentence); // 'Sean likes to chop parrots with his pet cat on Saturdays.'

For implementation details, please visit the npmjs page

Install

git clone https://github.com/svenanders/rantjs && cd rantjs
npm i
gulp serve

Then open http://localhost:8000

Development Plan

Easy way to choose alternative dictionaries

Indefinite article (a/an) automation

Overwriting (targets)

Capitalisation

Looping (repeaters)

Conditionals

Contributions

Contributions are welcome. Feel free to submit an issue/pull request. The following areas are of particular interest:

Documentation (wiki/code)

Fixing bugs

Optimization

Functions in the development plan

New language features

Testing. Currently, this is the result of the coverage report:

Statements   : 96.44% ( 461/478 )
Branches     : 67.65% ( 46/68 )
Functions    : 100% ( 18/18 )
Lines        : 97.24% ( 458/471 )

Ideally, it should be 100% on everything

New in version 1.0.0

Added option for custom dictionaries. Note that this replaces the built-in dictionary.

var yourCustomDic = {}
...
rant('your text', yourCustomDic);

A sample dictionary file can be found in the ./src folder. Also take a look at the built-in english dicionary in the same folder for reference.

New in version 0.9.x

0.9.7 - Added nonsense verbs from Rantionary

0.9.5 - Added verbs for success and defeat

0.9.4 - Added Death ()

0.9.3 - Added climb (<verb climb up|down>)

New in version 0.9.1

Rewrote Rantjs for CommonJS.

Removed several gulp tasks (concat, minify)

Refactored the tests

Renamed the app internally

New usage syntax (not compatible with 0.8.x)

You can now call Rantjs directly from require:

var sentence=require("rantjs")("<firstname male> likes to <verb-transitive> 
<noun.plural> with <pron poss male> pet <noun-animal> on <timenoun dayofweek plural>.");

Added randomization:

require("rantjs")("A random string: [rep:8][sep:\N]{\C}");
//A random string: XUACJGOGN

New in version 0.8.6

Added support for [rep:x]

Usage:

[case:title][sep:\n][rep:3]{I like <noun animal plural> but not <noun animal plural>}

// I Like Ogres but not Turtles
// I Like Bulls but not Horses
// I Like Poodles but not Owls

Note: [sep:\n] dictates newlines. Alternatively, you can specify \s for space.

New in version 0.8.5

Added support for [case]-tag.

Usage:

[case:upper]<firstname male>

Variants:

[case:none|default|word|upper|lower|case|sentence]

More Repositories

1

react-iframe

Simple solution for using iframes in React
TypeScript
412
star
2

react-breadcrumbs

Automatic breadcrumbs for React-Router
JavaScript
410
star
3

learn-react

Examples and modules that shows you how to use React
JavaScript
92
star
4

upcoming-conferences

Upcoming web developer conferences
90
star
5

react-stickydiv

React Component which keeps any HTML element sticky whenever it is scrolled beyond view
JavaScript
58
star
6

svenjs

A JavaScript framework for composable web apps
JavaScript
45
star
7

isomorphic-react-boilerplate

JavaScript
13
star
8

iAdHelper

Objective-C Helper class to ease integration with iAD for Cocos2D v3
Objective-C
12
star
9

ezreact

The easiest way to get started with React.js development
JavaScript
11
star
10

react-markdown-to-html

React Component that converts a Markdown file to HTML
JavaScript
9
star
11

React-Reflux-Presentation-Apr-21-2015-Teknologihuset-Oslo

React/Reflux Presentation Apr 21 2015 Teknologihuset Oslo
8
star
12

iOS7-Rest-Example-App

Consumes a REST API in iOS7 and populates a table view with the results
Objective-C
5
star
13

react-editable-div

React Component that enables editable divs
JavaScript
5
star
14

heroku-apigility

Heroku buildpack for hosting Apigility APIs
Puppet
4
star
15

reverse-spaceinvaders

You are the alien. Get them boys.
JavaScript
4
star
16

dom-find

Utils for finding DOM elements. Used by react-stickydiv
JavaScript
4
star
17

react-grid

A visual HTML gridsystem on top of Bootstrap 3
JavaScript
3
star
18

tictactoe

The classic game in pure javascript
JavaScript
3
star
19

Python-fundamentals

Assignments from the Python fundamentals course
Python
3
star
20

reactnative-uvapp

A port of Inmetas UV App to React Native
Objective-C
2
star
21

zombietron2084

Ludum Dare #31. It's 2084 and Zombies are everywhere. Your job is to take them out, and save the innocent people roaming around.
JavaScript
2
star
22

koa-proxy

A fantastic proxier for Koa 2
JavaScript
2
star
23

ezreact-starter

Starter app for EZReact
JavaScript
2
star
24

cra-react-iframe

React-iframe demo using CRA
JavaScript
2
star
25

SecureHash

Secure hash class for PHP
PHP
2
star
26

zf2-smarty-skeleton

PHP
1
star
27

Newhomepage

New blog homepage
PHP
1
star
28

ReactJSBlueprints

A collection of all the code provided in my book ReactJS Blueprints
1
star
29

imagetocanvas

Helper tools to put an image on a canvas
JavaScript
1
star
30

Lille-gangetabellen

En liten gangetabell
Processing
1
star
31

sdrive-docs

SDrive & Shadow Drive docs
1
star
32

universal-jsx

A standalone JSX compiler
JavaScript
1
star
33

Recsys-pa2

My solution to Recommender Systems Programming Assignment 2
1
star
34

zf2blog

Blog application using Zend Framework and Twig. Requires PHP v5.3.3 or above.
PHP
1
star
35

random-guid

Generate a random GUID
JavaScript
1
star
36

recsys_wa2

My solution to WA2 for Coursera course Introduction to Recommender Systems
Java
1
star
37

kafka-consumer

Start app for consuming Kafka topics
Rust
1
star
38

reactjs-presentation-javazone2014

Min presentasjon på JavaZone 2014
1
star
39

spacemonkey_processing_2

SHMUP made in Processing2
JavaScript
1
star
40

svg-sprites

demo
JavaScript
1
star
41

Recsys---Programming-Assignment-1

My solution to the first programming assigment for the Recommender System course
1
star
42

SarPoTwigExtractor

Module that traverses a given folder, extracts all strings within translate('') and stores every new string in the modules language files. Made for Zend Framework 2
PHP
1
star
43

universal-jsx-loader

Webpack loader for universal-jsx
JavaScript
1
star
44

security

JavaScript
1
star