• Stars
    star
    186
  • Rank 206,077 (Top 5 %)
  • Language
    Jupyter Notebook
  • Created about 6 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A corpus of poetry from Project Gutenberg

A Gutenberg Poetry Corpus

By Allison Parrish

This is a Gutenberg Poetry corpus, comprised of approximately three million lines of poetry extracted from hundreds of books from Project Gutenberg. The corpus is especially suited to applications in creative computational poetic text generation.

Download the corpus here.

How to use it

The corpus is provided as a gzipped newline-delimited JSON format. Here's a representative excerpt:

{"s": "The Heav'ns and all the Constellations rung,", "gid": "20"}
{"s": "The Planets in thir stations list'ning stood,", "gid": "20"}
{"s": "While the bright Pomp ascended jubilant.", "gid": "20"}
{"s": "Open, ye everlasting Gates, they sung,", "gid": "20"}
{"s": "Open, ye Heav'ns, your living dores; let in", "gid": "20"}

Each line of poetry is represented by a JSON object, with one object per line in the archive. The value for the s key is the line of poetry itself, and the value for the gid key is the ID of the Project Gutenberg book that the line comes from. You can use the value for gid to look up the title and author of the book that serves as that line's source, either "by hand" (just type the ID into Project Gutenberg's search box) or using a computer-readable version of the Project Gutenberg metadata (such as Gutenberg, dammit).

The Quick Experiments notebook included in this repository shows how to get up and running quickly with the corpus in Python. No need to install the Python module in this repository---working with the data is surprisingly straightforward!

How it was made

The corpus was generated using the included build.py script, which uses Gutenberg, dammit to provide access to books from Project Gutenberg. First, books with the string poetry listed in their "Subject" metadata are added to a list. Then, the plaintext versions of those books are scanned for lines that "look like" poetry, based on a set of textual characteristics, such as their length and capitalization. (See build.py for a list of these characteristics.) Finally, lines are compared against a word list (from wordfilter) to exclude lines that may contain egregiously offensive content.

NOTE: While a best-effort attempt has been made to exclude offensive language from this corpus, I have not personally vetted each of the three million lines. If you use this corpus to produce work for the public, please read over it first or take approriate measures to ensure that the language in the work is appropriate for you and your audience.read over it first or take approriate measures to ensure that the language in the work is appropriate for you and your audience.

The corpus contains only lines of poetry from books that the Project Gutenberg metadata identifies as being written in English and as being free from copyright (i.e., public domain) in the United States.

Examples of usage

Previous versions of this corpus have served as a foundation for several projects produced by myself and others:

If you make something cool with this corpus, let me know!

Build your own from scratch

You don't need to read any of the following if you just want to use the corpus. If you're interested in building your own version from scratch, read on.

This repository includes a script to build the Gutenberg Poetry corpus from the files included in Gutenberg, dammit. First, download the Gutenberg, dammit archive. Then install this package, like so:

pip install --process-dependency-links https://github.com/aparrish/gutenberg-poetry-corpus/archive/master.zip

You can then run the following command to produce your own version of the corpus:

python -m gutenbergpoetrycorpus.build --srczip=PATH-TO-GUTENBERG-DAMMIT-ZIP | gzip -c >gutenberg-poetry.ndjson.gz

Parameters for what gets included in the corpus can be adjusted in build.py. (E.g., it should be relatively easy to adapt this script to produce corpora of poetry in different languages!)

License

To the best of my knowledge, the Gutenberg Poetry corpus contains only text excerpted from works that are is in the public domain (at least in the United States). For avoidance of doubt, I release the particular arrangement of these excerpts in the provided format as CC0.

The code in this repository is provided under the following license:

Copyright 2018 Allison Parrish

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

More Repositories

1

pronouncingpy

A simple interface for the CMU pronouncing dictionary
Python
300
star
2

pytracery

Python port of Kate Compton's Tracery text expansion library.
Python
252
star
3

gutenberg-dammit

I wanted all of plaintext Project Gutenberg in an easy-to-use format, so I made this
Python
209
star
4

rwet

Notebooks and other materials for Reading and Writing Electronic Text
Jupyter Notebook
199
star
5

phonetic-similarity-vectors

Source code to accompany my paper "Poetic sound similarity vectors using phonetic features"
Jupyter Notebook
166
star
6

pycorpora

A simple Python interface for Darius Kazemi's Corpora Project.
Python
119
star
7

everywordbot

a simple script for creating @everyword-like twitter services
Python
114
star
8

rwet-examples

Reading and Writing Electronic Text Example Code
Python
95
star
9

pincelate

Easy to use ML model for spelling and sounding out words
Jupyter Notebook
89
star
10

seaduck

A bare-bones simulation-driven narrative framework
JavaScript
86
star
11

dmep-python-intro

Jupyter Notebook
82
star
12

pocket-sp

Design files for my Pocket SP Game Boy mod
73
star
13

pronouncingjs

a simple javascript interface to the CMU pronouncing dictionary (for node and browser!)
JavaScript
69
star
14

text-resources

I have this big list of links to text stuff that I like, so I thought I'd make it into a repository.
67
star
15

material-of-language

Notes and notebooks for Material of Language
Jupyter Notebook
63
star
16

gen-text-workshop

Tutorials, resources and links on generative text.
50
star
17

simpleneighbors

A clean and easy interface for performing nearest-neighbor lookups
Python
50
star
18

nb5js-proof-of-concept

proof of concept for a p5js-specific notebook interface
JavaScript
48
star
19

example-twitter-bot-node

Example Twitter Bot(s) for node.js
JavaScript
41
star
20

sfpc-gen-text-2015

notes and links for generative text workshop at SFPC 2015
40
star
21

nonsense-verse-pycon-2020

Materials for PyCon 2020 Workshop, "Nonsense verse... with Python and machine learning"
Jupyter Notebook
30
star
22

corpus-driven-narrative-generation

Thoughts toward and tutorial on corpus-driven narrative generation
Jupyter Notebook
22
star
23

comexmadivla

Computational exploration of magical and divinatory language
Jupyter Notebook
21
star
24

word-gan-book-generator

Generating books from GANs trained on bitmaps of whole words
Jupyter Notebook
21
star
25

plot-to-poem

"Translate" a plot from Mark Riedl's WikiPlots corpus into a poem. For NaPoGenMo 2017.
Jupyter Notebook
20
star
26

semanticsimilaritychatbot

A tiny unfussy corpus-driven chatbot based on semantic similarity
Python
20
star
27

nanogenmo2014

My NaNoGenMo project for 2014
TeX
18
star
28

bezmerizing

a tiny quirky library with some bezier curve functions
Jupyter Notebook
17
star
29

nanogenmo2015

repository for "our arrival," my nanogenmo 2015 project
Python
16
star
30

linear-lsystem-poetry

a strange textual interface for making poetry with l-systems
JavaScript
15
star
31

predictive-text-and-text-generation

rwet example for binder
Jupyter Notebook
15
star
32

universal-sentence-encoder-xling-runway

Wrapper for Universal Sentence Encoder for use in Runway
Python
12
star
33

mydinosaur

A fun library for bot makers to create RSS feeds for their bots.
Python
12
star
34

eroft

Electronic Rituals, Oracles and Fortune Telling
Jupyter Notebook
11
star
35

fullwidth

A keyboard layout file for OSX that turns your keystrokes into  full-width Unicode characters.
10
star
36

nanogenmo2017

The Average Novel
Jupyter Notebook
9
star
37

iceboxbreakfast

A William Carlos Williams-parodizing Mastodon bot
Python
9
star
38

plaintext-example-files

just a lil collection of plaintext example files
8
star
39

word-dcgan

why not train a gan on bitmaps of random words? what's the worst that could happen
Python
8
star
40

bobey-dig

Moby Dick with a head cold (for NaNoGenMo 2019)
Jupyter Notebook
7
star
41

xterm-ansi-bundle

xterm.js and ansi-escape-sequences bundled for browser use
JavaScript
7
star
42

tracery_kernel

A barebones custom Jupyter kernel for Tracery
Jupyter Notebook
6
star
43

wordfreq-en-25000

quick and dirty dump of 25k English words from wordfreq
Python
6
star
44

processing.py-workshop-examples

Example code for "Introduction to processing.py" workshop given at NYU/ITP, June 2011
Python
5
star
45

mimetree

Last Baby Standing: a Facebook game where you mate your friends together to breed the perfect, space fungus-resistant child. ("Mimetree" was the project code name.)
Python
5
star
46

cashclones

a twitter bot for making alternate history scenarios
Web Ontology Language
4
star
47

characterror

A shmup about spelling
Python
4
star
48

libraryofemoji

Source code for generating emoji names like those seen on @libraryofemoji.
Python
4
star
49

romcomsort

NaNoGenMo 2019 project: sort a bunch of romcoms
Jupyter Notebook
4
star
50

definer-tornado-on-heroku

A web application for randomly defining words. Demonstrates Tornado on Heroku.
Python
4
star
51

treestr

a Python string type that keeps track of its own history and metadata
Python
4
star
52

humanshangingout

can they be deceived? can they be deceived... by a robot?
Python
3
star
53

manipulating-font-data-flat

basic tutorial on using flat's opentype functions
Jupyter Notebook
3
star
54

ezi72ulx

Turn Inform 7 code into .ulx files—fast
Python
3
star
55

shoestrings

markov chain text generation library
Jupyter Notebook
3
star
56

twitteravatarkeyboard

Type using the Twitter avatars of users whose screen names have only one letter.
2
star
57

contentmalleable

a javascript snippet for breaking the contents of a contenteditable up into marked-up words
JavaScript
2
star
58

contextfreegengen

A context-free grammar generator generator, based heavily on Darius Kazemi's GenGen.
HTML
2
star
59

rwet-examples-c

rewriting my RWET examples in C
C
2
star
60

devos-vote

jupyter notebook for democracy
Jupyter Notebook
2
star
61

progdat

Notebooks etc for Programming with Data (NYU ITP)
Jupyter Notebook
2
star
62

sexywindsurfing

automated agent for apples to apples
Python
1
star
63

runway-markov-test

Making a very simple model for Runway
Python
1
star
64

chars74k-json-dump

Convert the stroke trajectories of the hand-drawn English letters in the Chars74k dataset to JSON
Jupyter Notebook
1
star
65

Simple-Flask-Example

A simple web application for word counts in a text file
Python
1
star