Welcome to Generative Poetry’s documentation!

Table of Contents

Generative Lexicon (lexigen.py)


These functions allow for controlled random sampling of words from Project Datamuse’s API.

Visual Poem (PDF,PNG) Generation (pdf.py)


These functions allow for the creation of all currently supported types of visual poems.

Poem Text Generation (poemgen.py, jolastic.py)


These functions generate the actual text of poems.

Sampling and Text Processing from Online Libraries (decompser.py)


With the decomposer module, one can sample random documents (books, etc.) from Project Gutenberg and Archive.org and rearrange the texts using Markov chain algorithms, cut-up, or by swapping instances of a part of speech between two texts.

The ParsedText class has several methods for random sampling.

Utilities


These functions are common utilities used by other modules.

Try now

Installing On Your Computer

Alternatively, if you install this on your own machine (see below), you can initalize the interactive menu by running the following command from a terminal/shell: generative-poetry-cli

Windows

Because this library currently relies on the Python package hunspell, which does not support Windows, use Docker to launch a Linux-based container, then use pip to install, and enter the Python interactive shell within:

docker run -t -d python python3 -m pip install generativepoetry && python3

OSX

OSX users must install hunspell beforehand:

brew install hunspell

Then download the en_US dictionary from http://wordlist.aspell.net/dicts/ and unzip it to /Library/Spelling/ and install using pip:

python3 -m pip install generativepoetry

You will also need Microsoft’s core font TTF files in /Library/Fonts/.

Linux

Ubuntu/Debian users should install hunspell-en-us, libhunspell-dev, and libdb++-dev beforehand and then install with pip:

sudo apt-get install hunspell-en-us libhunspell-dev libdb++-dev
python3 -m pip install generativepoetry