Code-based Spoken Word

Spoken word fascinates me. When it’s good it’s revelatory, like going to church. And when its bad its glorious. Maybe even better than when it’s good. I’m not sure which I prefer but I used the source code from Justin Bakse’s Computational Form class at Parsons School of Design to create a context-free grammar, spoken word generator. Put on your beret, sip your black coffee, snap your fingers and prepare yourself for some bad poetry.

CODE

The code below uses customizable story framework and lists of adjectives, objects, surfaces, verbs and nouns to generate the text. It took me awhile to clean up my word list to avoid the need of a/an, verb tense disagreements and other language quirks. It mostly works. Feel free to copy the code, just install Tracery, drop the code into your favorite editor and make some poetry.


// require /text/tracery.min.js

const storyGrammar = {

"story": ["a #surface# of #adjective#, #adjective# #noun_plural# #verb_ing# a #adjective#, #adjective#, #noun# and the #verb_ing# of #verb_ed# #noun_plural# #verb_ed# by the #noun#. a #noun# #verb_ing#, a #noun# #verb_ing# in the halo of #adjective# #noun_plural#. the #form# of a #adjective# #noun#, #verb_ing#, lazy in the bleach of #time#. a #shape# of #noun_plural# #verb_ed# against the #surface#. #adjective# #body_part# in a #device# #device_action#. #energies# energy, #verb_ed# #tension# to the point of #verb_ing#. a #adjective# #shape#."],

"adjective": ["grey", "single", "bloated", "frozen", "glistening", "wet", "cold", "white", "flat", "black", "rusty", "dark", "lazy", "lit", "fecal", "rotten", "bold", "thin", "dirty", "sodden", "vile", "smokey", "empty", "soulful", "lurid", "languid"],

"surface": ["sheet", "wall", "road", "plane", "box", "room", "slope", "hill", "tower", "pit", "bridge", "obelisk", "void", "structure", "pool", "span"],

"noun": ["moon","love", "finger", "tree", "filament", "soul", "memory", "cobweb", "spider web", "halo", "headlight", "bleached bone", "beam of light", "drop of spit", "dashboard", "tooth", "ring", "necklace", "child", "sibling", "twin", "blade", "whip", "skull", "jewel", "crown", "scepter", "cross", "grave", "bed", "inscription", "reflection", "ghost", "djinni", "wish", "prayer", "cyclopean eye", "song", "drone", "spasm", "boy", "girl", "man", "woman", "child", "dog", "wish"],

"noun_plural": ["echoes", "stars", "love", "fingers", "trees", "filaments", "souls", "memories", "cobwebs", "spider webs", "halos", "headlights", "bleach", "sunlight", "spit", "teeth", "energies", "wings", "wires", "faces", "gears", "borders", "clouds", "goals", "rewards", "failures", "spirits", "zealots", "immigrants", "syncophants", "bees", "insects", "beetles", "connections", "borders", "laws", "mandates", "rules", "prayers"],

"verb_ing": ["wavering", "reflecting", "borrowing", "stealing", "tripping", "scanning", "dreaming", "folding", "buckling", "floating", "breaking", "fading", "mating", "merging", "grinding", "kneeling", "praying", "swimming", "sleeping", "resting", "coiling", "blazing", "scouring", "boiling", "stewing", "frothing", "foaming", "loping"],

"verb_plural": ["echoes", "sings", "whispers", "drips", "dreams", "walks", "floats", "sizzles", "fates", "sighs"],

"verb_ed": ["swallowed", "stolen", "poised", "frozen", "framed", "lost", "stretched", "twisted", "folded", "jaded", "gilded", "sodden", "tilted", "shrunken", "oiled", "soiled", "summoned", "charred", "blackened", "seasoned", "blistered", "boiled", "sauteed", "blended", "pounded", "flattened", "scoured", "salted", "dissected", "ripped"],

"time": ["morning", "dawn", "afternoon", "evening", "dusk"],

"shape": ["loop", "thread", "square", "constellation", "pyramid", "plane", "jet", "cloud", "fog", "mountain", "arc", "web", "engine", "idea", "void"],

"body_part": ["teeth", "eyes", "fingers", "mouth", "toes", "feet", "words", "nipples", "breasts", "bosoms", "hair", "spine", "stomach", "heart", "chest"],

"device": ["camera", "phone", "computer", "portal", "TV monitor", "network", "hard drive", "console", "antenna", "junction"],

"device_action": ["flash", "saved", "encoded", "downloaded", "uploaded", "etched", "printed", "scanned", "programmed"],

"energies": ["potential and kinetic", "hot and cold", "microscopic", "oily", "dark and crystalline", "potential", "kinetic", "vibrating", "malignant", "graceful", "white and pure", "pure", "mystic", "primeval"],

"tension": ["loose", "taut", "tense", "tight",],

"form": ["memory", "shadow", "sculpture", "sketch", "veil", "shade", "shadow", "spirit", "memory", "echo", "inscription", "obelisk", "monolith", "prison", "coliseum", "platform", "skyscraper"],

}

document.body.style.background = "#444";

document.body.style.color = "#eee";

function main() {

let grammar = tracery.createGrammar(storyGrammar);

let story = grammar.flatten("#story#");

const storyDiv = document.createElement('div');

storyDiv.style = "font-size: 30px; margin: 10%; line-height: 1.5;";

storyDiv.textContent = story;

document.body.insertAdjacentElement("beforeend", storyDiv);

}

setTimeout(main, 10);