poem-gen is a poem generator created for NaNoGenMo 2014 by Camden Segal. It uses large source texts from Project Gutenberg to make poems.
The source texts are converted into word maps - each word is linked with all words that are used before it - so the generator can imitate the usage of the word from the source text.
Then a random word with existent rhymes in the source text is chosen as the first word of the poem. Each line is built from last word to first word using the word map. Words are added till the number of desired syllables is met.
This process is repeated for each line within the confines of the chosen rhyming scheme. Rhyme scheme, source text, and length are customizable.
To install the command line client:
npm install -g poem-gen
poem-gen can also be used as a module in other node projects if you install it locally:
npm install poem-gen
Options: -h, --help output usage information -V, --version output the version number -d, --data [file] Use built in data file [all] -f, --file [file] Use specific source file -r, --repeats [count] Times to repeat rhyming scheme -w, --words [count] Poem word length (overrides repeats) -v, --verbose Show extra info -s, --scheme [scheme] Scheme name or pattern
Used with the
-d option. Like
$ poem -d spooky/moby-dick
Used with the
-s option. Like
$ poem -s limerick.
You can also specify a custom scheme in the format of "aX" where
a is any character for use as a rhyming group specifier and
X is the number of syllables.
$ poem -s "a5 b10 a7" would generate a three line poem:
Built in schemes: