Tuesday, May 2, 2023

Psychology of the Supplement (process notes)

 This poem was cobbled together from my Candyman poems (one,two,three,four). I took lines from the poem and created several arrays that grouped phrases and parts of speech and then combined them in a controlled way to create a novel poem every run through.

The text itself creates a pocket ontology of potential poems that become incarnated into a specific poem every run through.

The technique I used was to create the arrays by hand, feed the bare javascript into ChatGPT and then have ChatGPT write the code. The entirety of the conversation is shown below. The only difference is I set the time to three seconds. 

const nouns = ["Narcissus", "the divide&conquer flower rapture", "that previous wOrd", "every gift", "resonating possession", "PRIDE in open space ", "an oath in confinement", "love", "dreaming in unnamed spaces", "the illuminations of flames", "love with its many symbols", "history", "Symbols of the condemned", "the noise", "honeybees", "delicious peace", "a stimulated eye", "the buzzing of bees", "g0d" ]; const vbg = ["craving","wasting","driving","stunting","denying","aspiring","submitting","conquering","divulging","secreting"]; const v3s = ["serves","commands","rains","dries","swallows","chokes","seeks","loses","fears","loves"]; const prep = ["of Her wormy tendrils","with invisible grammars","into your smile","in a voice of faith","of your intentions"]; const phrase = ["we could be of two shadows","pain makes men gods","g0d makes men animals"]; const cmd = ["signify the elemental","seek a symphony"]; const phrases = ["NOUN is NOUN", "NOUN V3S NOUN", "NOUN PREPPHRASE NOUN V3S NOUN", "PHRASE", "CMD", "VBG NOUN", "VBG NOUN is NOUN"];
ChatGPT

Hello! How may I assist you with the code?

User
I would like to make a random poem generator that combines the various parts of speech using the final array called "phrases". NOUN would pull from nouns, and so on.
ChatGPT

Sure! Here's some sample code that you can use to generate random poems using the phrases array:

scss
const nouns = ["Narcissus", "the divide&conquer flower rapture", "that previous wOrd", "every gift", "resonating possession", "PRIDE in open space ", "an oath in confinement", "love", "dreaming in unnamed spaces", "the illuminations of flames", "love with its many symbols", "history", "Symbols of the condemned", "the noise", "honeybees", "delicious peace", "a stimulated eye", "the buzzing of bees", "g0d" ]; const vbg = ["craving","wasting","driving","stunting","denying","aspiring","submitting","conquering","divulging","secreting"]; const v3s = ["serves","commands","rains","dries","swallows","chokes","seeks","loses","fears","loves"]; const prep = ["of Her wormy tendrils","with invisible grammars","into your smile","in a voice of faith","of your intentions"]; const phrase = ["we could be of two shadows","pain makes men gods","g0d makes men animals"]; const cmd = ["signify the elemental","seek a symphony"]; const phrases = ["NOUN is NOUN", "NOUN V3S NOUN", "NOUN PREPPHRASE NOUN V3S NOUN", "PHRASE", "CMD", "VBG NOUN", "VBG NOUN is NOUN"]; function getRandomWord(array) { return array[Math.floor(Math.random() * array.length)]; } function generatePoem() { const noun1 = getRandomWord(nouns); const noun2 = getRandomWord(nouns); const noun3 = getRandomWord(nouns); const v3s1 = getRandomWord(v3s); const vbg1 = getRandomWord(vbg); const prep1 = getRandomWord(prep); const phrase1 = getRandomWord(phrase); const cmd1 = getRandomWord(cmd); const chosenPhrase = getRandomWord(phrases); let poem = chosenPhrase.replace("NOUN", noun1).replace("NOUN", noun2).replace("NOUN", noun3) .replace("V3S", v3s1) .replace("VBG", vbg1) .replace("PREPPHRASE", prep1) .replace("PHRASE", phrase1) .replace("CMD", cmd1); return poem; } console.log(generatePoem());

This code defines the getRandomWord() function to retrieve a random word from a given array, and the generatePoem() function to generate a random poem using the phrases array and the other arrays of words.

When generatePoem() is called, it randomly selects words from the different arrays using getRandomWord(), and then randomly selects a phrase from the phrases array. It then replaces the placeholders in the selected phrase with the selected words, using JavaScript's replace() method.

Finally, it returns the generated poem.

You can call the generatePoem() function multiple times to generate different poems.

User
scrap that
ChatGPT

Sure, let me know if you have any other questions or if there's anything else I can assist you with!

User
We need to wrap it in HTML then randomly generate phrases on 1 second timer that updates to innerHTML
ChatGPT

Sure, here's some sample code that you can use to display the randomly generated poem in an HTML page and update it every second:

HTML:

php
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Random Poem Generator</title> </head> <body> <div id="poem-container"> <p id="poem"></p> </div> <script src="script.js"></script> </body> </html>

JavaScript:

scss
const nouns = ["Narcissus", "the divide&conquer flower rapture", "that previous wOrd", "every gift", "resonating possession", "PRIDE in open space ", "an oath in confinement", "love", "dreaming in unnamed spaces", "the illuminations of flames", "love with its many symbols", "history", "Symbols of the condemned", "the noise", "honeybees", "delicious peace", "a stimulated eye", "the buzzing of bees", "g0d" ]; const vbg = ["craving","wasting","driving","stunting","denying","aspiring","submitting","conquering","divulging","secreting"]; const v3s = ["serves","commands","rains","dries","swallows","chokes","seeks","loses","fears","loves"]; const prep = ["of Her wormy tendrils","with invisible grammars","into your smile","in a voice of faith","of your intentions"]; const phrase = ["we could be of two shadows","pain makes men gods","g0d makes men animals"]; const cmd = ["signify the elemental","seek a symphony"]; const phrases = ["NOUN is NOUN", "NOUN V3S NOUN", "NOUN PREPPHRASE NOUN V3S NOUN", "PHRASE", "CMD", "VBG NOUN", "VBG NOUN is NOUN"]; function getRandomWord(array) { return array[Math.floor(Math.random() * array.length)]; } function generatePoem() { const noun1 = getRandomWord(nouns); const noun2 = getRandomWord(nouns); const noun3 = getRandomWord(nouns); const v3s1 = getRandomWord(v3s); const vbg1 = getRandomWord(vbg); const prep1 = getRandomWord(prep); const phrase1 = getRandomWord(phrase); const cmd1 = getRandomWord(cmd); const chosenPhrase = getRandomWord(phrases); let poem = chosenPhrase.replace("NOUN", noun1).replace("NOUN", noun2).replace("NOUN", noun3) .replace("V3S", v3s1) .replace("VBG", vbg1) .replace("PREPPHRASE", prep1) .replace("PHRASE", phrase1) .replace("CMD", cmd1); return poem; } // Get the poem container and the poem element const poemContainer = document.getElementById("poem-container"); const poem = document.getElementById("poem"); // Update the poem every second setInterval(() => { // Generate a new poem const newPoem = generatePoem(); // Update the poem element with the new poem poem.innerText = newPoem; }, 1000);

This code defines an HTML page with a div element to hold the generated poem, and a JavaScript file with the

User
ok, combine both files into one
ChatGPT

Sure, here's the combined HTML and JavaScript code:

php
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Random Poem Generator</title> </head> <body> <div id="poem-container"> <p id="poem"></p> </div> <script> const nouns = ["Narcissus", "the divide&conquer flower rapture", "that previous wOrd", "every gift", "resonating possession", "PRIDE in open space ", "an oath in confinement", "love", "dreaming in unnamed spaces", "the illuminations of flames", "love with its many symbols", "history", "Symbols of the condemned", "the noise", "honeybees", "delicious peace", "a stimulated eye", "the buzzing of bees", "g0d" ]; const vbg = ["craving","wasting","driving","stunting","denying","aspiring","submitting","conquering","divulging","secreting"]; const v3s = ["serves","commands","rains","dries","swallows","chokes","seeks","loses","fears","loves"]; const prep = ["of Her wormy tendrils","with invisible grammars","into your smile","in a voice of faith","of your intentions"]; const phrase = ["we could be of two shadows","pain makes men gods","g0d makes men animals"]; const cmd = ["signify the elemental","seek a symphony"]; const phrases = ["NOUN is NOUN", "NOUN V3S NOUN", "NOUN PREPPHRASE NOUN V3S NOUN", "PHRASE", "CMD", "VBG NOUN", "VBG NOUN is NOUN"]; function getRandomWord(array) { return array[Math.floor(Math.random() * array.length)]; } function generatePoem() { const noun1 = getRandomWord(nouns); const noun2 = getRandomWord(nouns); const noun3 = getRandomWord(nouns); const v3s1 = getRandomWord(v3s); const vbg1 = getRandomWord(vbg); const prep1 = getRandomWord(prep); const phrase1 = getRandomWord(phrase); const cmd1 = getRandomWord(cmd); const chosenPhrase = getRandomWord(phrases); let poem = chosenPhrase.replace("NOUN", noun1).replace("NOUN", noun2).replace("NOUN", noun3) .replace("V3S", v3s1) .replace("VBG", vbg1) .replace("PREPPHRASE", prep1) .replace("PHRASE", phrase1) .replace("CMD", cmd1); return poem; } // Get the poem container and the poem element const poemContainer = document.getElementById("poem-container"); const poem = document.getElementById("poem"); // Update the poem every second setInterval(() => { // Generate a new poem const newPoem = generatePoem(); // Update the poem element with the new poem poem.innerText = newPoem; }, 1000); </script> </body> </html>

This code defines the HTML page with the div element to hold the generated poem, and the JavaScript code to generate the poem and update it every second.

No comments:

Post a Comment