Semi-revived: Novelwriting

One of my oldest projects, dating to at least 2003, is a text generator written in Python and called Novelwriting. I've updated it for compatibility with python3, after being inspired by a thread on metafilter.

Novelwriting lets you specify a grammar, and then it produces sentences that match the grammar.

Here's a simple example:

Start: person " once said that " folk-saying ".\n";
person: "My " relative | "The President" | "Cardinal Fang";
relative: "Mother" | "Aunt" | "Grandmother" ;
folk-saying: "a rolling stone gathers no moss"
    | "a stitch in time saves nine"
    | "no-one expects the Spanish Inquisition";

And here are some outputs:

The President once said that a rolling stone gathers no moss.

Cardinal Fang once said that a stitch in time saves nine.

My Aunt once said that a rolling stone gathers no moss.

The President once said that no-one expects the Spanish Inquisition.

Entry first conceived on 26 May 2021, 17:54 UTC, last modified on 5 June 2021, 15:51 UTC
Website Copyright © 2004-2021 Jeff Epler