twaddle

Twaddle Introduction

Twaddle is a python package for templated text generation. It originated as a reimplementation of a subset of Rant v3, some minor adaptations have since been made.

OK, so what does that mean?

In short, Twaddle takes input like:

The <noun-person.plural> <verb.ed-transitive> \a <adj> <noun-vehicle>.

and - using the sample dictionaries provided in this repository - produces output like:

The women knew a blue helicopter The men flew a big motorbike The people heard a red van The babies knew an old bike

And so on. This example sentence relies on some of the most fundamental features of Twaddle:

Some more advanced features of Twaddle include:

How do I get started?

Below is a quick guide as a memory aid for those already familiar with how Twaddle works. For full installation and usage documentation, see using Twaddle.

Quick guide

You can install Twaddle via pip

pip install twaddle

You can then import the TwaddleRunner class:

from twaddle.runner import TwaddleRunner

Instantiate it with the path to your dictionaries and choice of whether to use oersistent mode:

runner = TwaddleRunner(<path_to_dictionaries>, persistent=<True/False>)

And you’re ready to start feeding it your sentences:

runner.run_sentence(<your_twaddle_sentence_here>)