Sonnetizer is a program written by Ross Goodwin that generates 14-line rhyming sonnets from any text corpus. It requires Python 2.7, nltk, numpy, and some other standard Python modules to run properly.
Four versions of Sonnetizer currently exist: sonnetizer_a, sonnetizer_g, sonnetizer_m, and poetron.
To run Sonnetizer, download the files along with any text corpus you wish to sonnetize, and enter the following in the command prompt:
$ python [sonnetizer file].py [text corpus].txt
sonnetizer_a.py allows for computer-assisted writing.
sonnetizer_g.py generates 14-line sonnets with 10-syllable lines and the standard ABABCDCDEFEFGG rhyme scheme.
sonnetizer_m.py generates 14-line sonnets, mostly in iambic pentameter, with 10-syllable lines and the standard ABABCDCDEFEFGG rhyme scheme.
poetron.py generates 14-line sonnets with 6-word lines and the standard ABABCDCDEFEFGG rhyme scheme.
For a sample of the output, check out this book of 10,000 sonnets generated by Sonnetizer from the sonnets of William Shakespeare.