Mashup Poem Generation
Re-writing The Red Wheelbarrow
HW due Tuesday, 3 APR
In class today we breezed through running the script [
mashup_madlib.py] that re-creates William Carlos Williams’ poem “The Red Wheelbarrow.” For your homework I’ve asked that you play around with the process: try pulling from different lists (see ingredients, below) to see what comes up.
Copy your favorites into a Markdown document and be prepared to share one of them – and to share your process – in class on Tuesday. Be sure that you’re documenting which lists you’re using to create your favorites. You’ll submit a properly-formatted Markdown document that contains (1) at least 10 created poems that (2) use some combination of at least 6 different lists. Your Markdown file should indicate which lists were used to create each of your poems.
mashup_madlib.py(which is located in
/[your_username]/mashup_madlib/in your pythonanywhere account. )
- this repository full of lists
- a Markdown document of your own creation (need a cheatsheet?)
- William Carlos Williams’ The Red Wheelbarrow for reference.
- Explore Darius Kazemi’s list of Corpora. (Also check out some of his projecst.)
- When you have a list that you’d like to use in your poem mashup, click the “Raw” button in the repository.
- Copy the raw URL to your clipboard.
- Paste that URL into line 22 or line 25 or line 28 of
- Be sure to change the corresponding line 32, 33, or 34 (respectively) to reflect the name of your new list. Computers are dumb: be smarter than the computer by typing exactly what it expects to see and by honoring quotation marks.
- Save your file in PythonAnywhere.
- To run the Python script, rather than just clicking the “Run” button in PythonAnywhere, we’re going to run our scripts from a command line.
- In PythonAnywhere, open your Console and select “Bash”. This will open a “command prompt.”
- There are many commands you can use to navigate the BASH shell. We’re going to use only a few.
pwd(“print working directory”)
ls(list files and directories in current working directory)
cd ______(change directory) EXAMPLE:
$ cd mashup_madlibmoves you from the current working directory, “down” a level, into the directory called “mashup_madlib”. To navigate back “up” a level, you enter
$ cd ..
python ______.py(tells the shell to run the Python compiler in the command line.) EXAMPLE:
18:44 ~/mashup_madlib $ python mashup_madlib.pywill run the python script named “mashup_madlib.py” in the BASH shell using the Python compiler. BUT you have to be in the mashup_madlib directory (if you’re not sure,
- Protip: If you’re a visual learner, like me, remember that “directory” is conceptually the same as a folder in windows-based systems: it’s a container for files and folders.)
- So, when you open the shell for the first time, type
cd mashup_madliband then type
ls. You should at least see the name of the script we need,
- As long as you see that file name, you can then type
python mashup_madlib.pyand the script will write poems to the BASH console.
- As you do this, copy your favorites from the console into a markdown file of your creation so that you can make sure to save your favorites. Also, as you’re iterating, make sure you’re keeping track of the lists you’re using to cerate each poem.
- Return to STEP TWO to try it all over again with new lists.
- Protip If you press the
^arrow key (not the caret) in the BASH console, you can cycle through your previous commands rather than typing
python mashup_madlib.pyevery time.
Course Archive: 2017
An Introduction to Digital Humanities by Jacob Heil is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.