Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.


This respository contains a variety of generative grammars, in Kate Compton's Tracery formalism, for use in Twitterbots (via George Buckenham's

In each case, a main Tracery grammar does the generation of short texts which can then tweet. If a response grammar is present, this will allow to generate an apt response to any mention of the bot's handle on Twitter.

The main grammar and the response grammar work together, with the latter using the non-terminals of the former to construct its replies.

In special cases, the main grammar and its response grammar are designed to talk back-and-forth with each other, thereby elaborating a long threaded sequence of tweets over time. Check out the story-telling grammar in the Story generator directory. In story generation, the main grammar generates the first event, and the response grammar generates subsequent events by responding to itself until it generates the closing event of the story.

In the DBpedia riff generator, the main grammar generates a riff on some categorization (of a book, film, game, etc.) in DBpedia. The response grammar then replies with a request -- aimed at the story-telling bot above via an @ mention -- to generate a story on this theme. So, the response grammar responds by sending a tweet to another bot that will then talk to itself to build a story over multiple tweets.

Note that the content of the grammar in each case is often so large (it has been generated by a machine, from a database of relevant information, rather than hand-crafted) that the grammar uses cryptic two-letter shorthands to name its non-terminals, making the whole grammar hard to read for humans. This is a necessary requirement if the grammar is to fit into the storage space allocated by

Please also note the following VERY IMPORTANT point:

A number of the grammars in this repository are machine-generated from a large database of (more-or-less) creative similes that have been harvested from humans on the web (using the pattern "about as X as Y Z"). Human creativity is a mixed bag, especially on the web. Most of the similes are vivid and many are humorous, but some are tasteless and more than a few will be offensive. We've done our best to filter the worst examples, but not every combination of words that might cause offense has been removed. Many examples are borderline, and we want the database to represent a good spread of linguistic creativity, minus hateful misogyny and bigotry. So please remember this caution when delving into these grammars. We haven't added specific examples by hand, and our intent is not to offend. If you find a specific example to be egregious, let us know and we'll remove it.

Please address any questions to:


Tracery grammars for building creative Twitterbots. Contains generative grammars for story-telling, metaphor generation, ironic put-downs, Trumpisms, short poems, etc.







No releases published


No packages published