Skip to content

Instantly share code, notes, and snippets.

@Hbentzur
Created March 18, 2018 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Hbentzur/9757e29b791db1f75ed8254b3288b3c7 to your computer and use it in GitHub Desktop.
Save Hbentzur/9757e29b791db1f75ed8254b3288b3c7 to your computer and use it in GitHub Desktop.
Birds & Yoel Hoffmann
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: tracery in /Users/Hbentzur/anaconda3/lib/python3.6/site-packages\n",
"\u001b[33mYou are using pip version 9.0.1, however version 9.0.2 is available.\n",
"You should consider upgrading via the 'pip install --upgrade pip' command.\u001b[0m\n"
]
}
],
"source": [
"!pip install tracery"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import tracery"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"I remember things that happened in an empty building (which is to say, one they hadn’t yet finished building) in Ramat Gan, in the fifties. Then too (as now) legs were the principal thing. The world was full of legs of all sorts and there was movement in space. Someone — Ezra Danischevsky — said to me once: I want to be an elevator repairman (you can imagine the motion and its various directions). In that (empty) building, a woman who’s now seventy-four (if she’s not dead) took off her dress.\n"
]
}
],
"source": [
"hoffmann_moods = \"I remember things that happened in an empty building (which is to say, one they hadn’t yet finished building) in Ramat Gan, in the fifties. Then too (as now) legs were the principal thing. The world was full of legs of all sorts and there was movement in space. Someone — Ezra Danischevsky — said to me once: I want to be an elevator repairman (you can imagine the motion and its various directions). In that (empty) building, a woman who’s now seventy-four (if she’s not dead) took off her dress.\"\n",
"\n",
"print(hoffmann_moods)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"['the foam of the sewers at the end of the sea waves', 'the tiles with a repeating marble pattern', 'to write with markers on an eggshell', 'leaving your blancket on the chair in the morning', 'stepping on a sea turtle', 'putting a tea cup on a the book you were just reading', 'not loving your brother', 'kicking a wet plastic bag', 'a burn on the tongue', 'unclosed breakups', 'The smell of burning tires', 'sleepovers after everyone already fell asleep', \"the time in the army when I knew nothing I'll do won't metter anymore\", 'wet leather gloves', \"old people's ringtones\", 'insults']\n"
]
}
],
"source": [
"the_opposite_of_sweetness = [\"the foam of the sewers at the end of the sea waves\",\n",
" \"the tiles with a repeating marble pattern\",\n",
" \"to write with markers on an eggshell\",\n",
" \"leaving your blancket on the chair in the morning\",\n",
" \"stepping on a sea turtle\",\n",
" \"putting a tea cup on a the book you were just reading\",\n",
" \"not loving your brother\",\n",
" \"kicking a wet plastic bag\",\n",
" \"a burn on the tongue\",\n",
" \"unclosed breakups\",\n",
" \"The smell of burning tires\",\n",
" \"sleepovers after everyone already fell asleep\",\n",
" \"the time in the army when I knew nothing I'll do won't metter anymore\",\n",
" \"wet leather gloves\",\n",
" \"old people's ringtones\",\n",
" \"insults\"]\n",
" \n",
"\n",
"print(the_opposite_of_sweetness)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"hoffmann_b = [\"I remember things that happened in an empty building (which is to say, one they hadn’t yet finished building) in Ramat Gan, in the fifties.\",\n",
" \"Someone — Ezra Danischevsky — said to me once: I want to be an elevator repairman (you can imagine the motion and its various directions).\",\n",
" \"In that (empty) building, a woman who’s now seventy-four (if she’s not dead) took off her dress.\" \n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"hoffmann_about = [\"how the Bible that the principal gave me at the end of eighth grade saved my life (it was in the pocket of my army vest and the bullet went into it up to the Book of Nehemiah)\",\n",
" \"how, as though in an American movie, I went to the wedding of a girl I was in love with once and at the last minute etcetera.\"\n",
"]"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"- - - \n",
" - - \n",
" - - \n",
" -\n"
]
}
],
"source": [
"birds = [\n",
" \"- - - \\n - - \\n - - \\n -\",\n",
" \"- - - \\n - - \\n - - \\n -\",\n",
" \" -- - - - - \\n - -- -\\n - \\n - \",\n",
" \" -- - -\\n - - -\\n - -\\n - - \\n -\"\n",
"]\n",
"\n",
"print (birds [1])"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"- - - \n",
" - - \n",
" - - \n",
" - \n",
"\n",
"There are lots of birds in the sky suddenly. \n",
"\n",
"In that (empty) building, a woman who’s now seventy-four (if she’s not dead) took off her dress. Then too (as now) the opposite of sweetness was the time in the army when I knew nothing I'll do won't metter anymore. I could write about how the Bible that the principal gave me at the end of eighth grade saved my life (it was in the pocket of my army vest and the bullet went into it up to the Book of Nehemiah) \n",
" \n",
"A bona fide story with plot twists and intrigue, \n",
"and an ending cut off like a salami – \n",
"to keep it modern.\n"
]
}
],
"source": [
"rules = {\n",
" \"origin\": \"#birds# \\n\\nThere are lots of birds in the sky suddenly. \\n\\n#hoffmann_b# Then too (as now) the opposite of sweetness was #the_opposite_of_sweetness#. I could write about #hoffmann_about# \\n \\nA bona fide story with plot twists and intrigue, \\nand an ending cut off like a salami – \\nto keep it modern.\",\n",
" \"birds\" : birds,\n",
" \"hoffmann_b\" : hoffmann_b,\n",
" \"hoffmann_about\" : hoffmann_about,\n",
" \"the_opposite_of_sweetness\" : the_opposite_of_sweetness\n",
"}\n",
"grammar = tracery.Grammar(rules)\n",
"print(grammar.flatten(\"#origin#\"))\n",
" "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"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.6.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment