Skip to content

Instantly share code, notes, and snippets.

@aparrish
Last active February 1, 2024 19:13
Show Gist options
  • Save aparrish/fe4836d40fd82714acaa5a00f99b8b8d to your computer and use it in GitHub Desktop.
Save aparrish/fe4836d40fd82714acaa5a00f99b8b8d to your computer and use it in GitHub Desktop.
this is my assignment, hooray!
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Implementations of early and well-known poetry generators\n",
"\n",
"By [Allison Parrish](http://www.decontextualize.com/)\n",
"\n",
"This notebook has some Python implementations of a number of early and well-known poetry generators, including Knowles and Tenney's *A House of Dust*, Strachey's love letter generator and Nick Montfort's *Taroko Gorge*.\n",
"\n",
"This is my cool assignment, I made a poem about linen with short lines. Linen and line are related etymologically. I did a talk on this!"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"very wrinkle.[1] to\n",
"also are comfortable\n",
"as faster from plant\n",
"material weather\n",
"such significantly\n",
"is also\n",
"characteristics,\n",
"absorbent in for\n",
"although than\n",
"difficult woven a\n",
"cotton. wear yarn,\n",
"takes properties,\n",
"linen can more\n",
"knitted. to weave is\n",
"in to has garments.\n",
"to is Linen and\n",
"fibers. other fiber,\n",
"dries as its cotton.\n",
"both harvest and\n",
"Linen as strong be\n",
"than made like well\n",
"natural Linen and is\n",
"these valued\n",
"tendency Because It\n",
"textiles and use of\n",
"hot distinctive flax\n",
"It than longer\n",
"cotton\n"
]
}
],
"source": [
"import random\n",
"import textwrap\n",
"\n",
"newspaper = \"\"\"\n",
"Linen is very strong and absorbent and dries faster than cotton. Because of these properties, linen is comfortable to wear in hot weather and is valued for use in garments. Linen textiles can be made from flax plant fiber, yarn, as well as woven and knitted. Linen also has other distinctive characteristics, such as its tendency to wrinkle.[1] It takes significantly longer to harvest than a material like cotton although both are natural fibers. It is also more difficult to weave than cotton.\n",
"\"\"\"\n",
"\n",
"words = newspaper.split()\n",
"random.shuffle(words)\n",
"\n",
"print(textwrap.fill(\" \".join(words), 20))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment