Skip to content
/ CentoPy Public

Automatic cento poem generator written in Python3

License

Notifications You must be signed in to change notification settings

drkndl/CentoPy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CentoPy

A cento is a type of poem where each line is taken from a different poem, and then assembled in such a way that the overall poem makes sense. It is also often aptly called "patchwork poetry". One of the most popular contemporary centos is John Ashbery's "The Dong with the Luminous Nose". The poem and an accompanying annotated guide can be found here.

This repository contains code to create a cento by choosing a random line from a random poem out of a database of poems and related metadata such as titles, poets and tags. The database PoetryFoundationData.csv was created by Divy Bramhecha, who scraped thousands of poems from The Poetry Foundation. The dataset is available on Kaggle.

Clone the repository by pressing the Download ZIP button in the Code dropdown menu marked in green, or used the git clone command.

cento_maker.py contains the main code to automatically generate the cento poems. Just change the num_lines attribute to choose the total number of lines desired in your cento and run the program.

Why create a cento generator instead of just training the dataset to let an AI create poetry? The reasons are twofold: 1) There are plenty of projects that have already attempted to do the latter better than I can ever hope to do, 2) I am too lazy to use ML right now.

Dependencies

The code requires the following dependencies:

  • csv
  • Pandas
  • random

Examples

A respectable cento generated by the code so far:

and, you, passing over again,

 my grandfather’s shriveled aspirations

Tobacco pockets, a tomato sniffed,

And have focused instead on inconsequential

Or another one:

Out of the misty eastern cave,

Where, all the long and lone daylight,

Thou wovest dreams of joy and fear,

Which make thee terrible and dear,—

Each flower a wilting sun

Flopped like a fish against the muddy ground.

tossed into the sea.

To-Do

  • Add the right spaces (space issues causes several lines of poetry to be considered a single line). This could require a complete overhaul of the database.
  • Remove numbering for sub-poems in the poem lines
  • Clean up tags
  • Option to group poems by theme/tags
  • Ensure poem has grammatical continuity
  • Create user interface

License

This code is licensed by the GNU General Public License v3.0. You can read more about it here.

About

Automatic cento poem generator written in Python3

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages