Categories
Computational Approaches to Narrative

CAtN Final

Introduction

Two weeks ago, I came up with an idea that functioned more as a momentary placebo amidst finals and all the underlying chaos. I wanted accomplish some kind of way to give a more “magic realism” feel to a particular series of news reports (I initially thought of NYTimes). However, after bouncing around the idea in my head several times I decided it was not a something I was willing to test and possibly fail about due to time. I wanted to make an experiment that led me to something fun, and even an idea that might lead me somewhere else.

In any case, I decided to maintain the Magical Realism element. After taking a look at @MagicRealismBot in Twitter, as well as reading this interview with their creators Ali and Chris Rodley, the idea became clear. I recommend reading the interview, it is entertaining to see the mindset and the process behind such an effective and endearing tool.

I thought about some comments made in class about using GPT-2 to help with thesis process (Neta and Nicole?). In any case, I thought it would be fun to give some of the articles I usually read in one of my favorite New Media online platform, Creative Applications Network, a bit of a twist. Specifically, the way in which the website displays the entries for each article made it easier. I’ll explain in more detail below.

Process

Creative Applications Network

You can follow along this notebook I made in Google Collab. I decided to scrape all of the blog entries from the blog. By blog entry I mean the short pieces of text you see below. Every blog article had one. After scraping the 147 entries, I made a CSV file out of them so I could take a better look.

I noticed most of the entries (or at least the ones I was interested in) followed a similar pattern. “X project” is a “Y adjective to make it sound innovative” “Z New Media name” “Whatever it did”. I made a small diagram of it below.

Right away I thought this type of one-line format (after cleaning up the data a bit) would mix perfectly with Magic Realism Bot’s posts. (weird saying it that way) To clarify, the cleanup involved removing the names of the work, and of the artists. So I took all of those and formatted them into a format acceptable by spacy and the Markov chain algorithm. I wanted to make a script for it. This involved making a script that received a CSV file with one column of text and a name and outputs a new file with a ‘name’, ‘index’, ‘total’, and ‘text ‘ as column headers. All of this is in the notebook. I then proceeded to scrape tweets from the MagicRealismBot on Twitter.

Magic Realism Bot

I will not go into much detail about how I scraped it, since it is on the notebook. However, I just want to make clear I obtained about 3200 tweets, which I took a screenshot of below.

Spacy, Tracery and the fun part

After having both of my sources, I joined them into one CSV file. I processed the file using Spacy and Allison’s guide for a corpus-driven narrative generation. The whole thing was about 4800 entries.

I also used a copy of Allison’s notebook. With Allison’s notebook, I was able to use spacy. Spacy gave me my entities, as well as actions, verbs, objects, etc… which I used as an input for Tracery.

I made a couple of tests to see how it would go. And I think it went pretty well.

AND MY FAVORITE (which sadly I got too excited to remember to even screenshot):

“An interactive installation that facilitates collaboration between a human and a puddle of alcohol.”

Other remarkable examples:

A bisexual fisherman falls in love with the use of CCTV.

A professor reads a poem about an arduino that can destroy metaphysics.

A new life as a performance.

A theologian discovers that Wikipedia does not exist.

The dancer’s body is extended and manipulated as a tool to quantify the world.

An interactive installation and performance inspired by light rays traveling in a latent space of situations.

A project explores possible alternatives of how we experience the materiality of nature through the mediums of fiction.

Exploring behavior-based design systems that are self-aware, mobile, and self-structure / assemble.

To compensate for the lack of material I had from the Blog, I had to duplicate those entries several times, as well as some of the examples shown before. By the end it came out to a 3200(MRbot) vs. 1600 entries.(creativeappsnet + handpicked generated).

Output?

So I came around this talk by Kate Compton (creator of Tracery) who gave the most enlightening talk about procedural generation, and it occurred to me I did not want to leave the output of this experiment only in text.

So through this VR experiment I wanted to include several elements I became captivated by during the semester….such as the sense of waiting present in Epitaph, or the idea of spatial(enviromental) storytelling in Bitsy. Also, I felt some of these ideas were brilliant, and on a computer screen I seemed to get distracted with my other 127 tabs.

So ideally, you would be able to walk to other beams of light which generate text with other parameter values. ( If I was to use GPT-2 for example, each beam on a row would contain +0.1 in the temperature parameter). You would be able to pick up some of these and keep them.

EDIT: Worked!

Categories
Computational Approaches to Narrative

NaNoGenMo

…or 55 places the sun won’t shine on

This assignment is meant to be an entry to the National Novel Generation Month contest. The premise is quite simple: use code to generate a novel of 50k+ words, and submit the novel and code. I will explain in more detail below. As finals are kind of creeping in, I found humor and comfort in this project. Honestly, I never expected it to be so entertaining and exceptionally comical in a not so obvious way (my roommates did not share the feeling). I wanted my NaNoGenMo (National Novel Generation Month) entry to have a magical realism style to it. In a sense, I took this project as a building block towards my final project, and I shall publish a blog post on that next week.

In any case, I decided to use train GPT-2 on a corpus of text that consisted of several short stories from Jorge Luis Borges, such as “The Aleph”, in addition to two novels from Gabriel Garcia Marquez : “A hundred years of solitude” and “Love in times of cholera”. I also attempted adding work from Isabel Allende, as well as Jose Saramago. I had only read these authors in spanish before, and though I found Allende captivating in english as well, it did not feel the same. With Saramago, on the other hand, once I added “Blindness” to the mix the resulting text seemed quite violent. I might use it for my final, however for this long text it seemed unnecessary.


After tuning the model to my taste, (you can find my notebook on the Github repository) I decided to produce several short stories with the same starting prompt: “The sun had not shone on that part of the town for many years.” and cut them off at 55. I later proceeded to fix the style (too many random “/n” popped in the middle of a sentence) using the Atom editor to replace these characters with a standard “space” character. I also trimmed extra words at the end of each small story until I reached a punctuation mark. That way they would appear to be tidier, more of a short story, and less like the author fainted mid-sentence.

In the GitHub repository you’ll find a compiledText.txt which contains the corpus. Novel.pdf contains “55 places the sun won’t shine on”, and you can also see the google collab notebook and the zipped trained model. I leave you with some extracts from the novel:

====================

4

The sun had not shone on that part of the town for many years. The marble houses were on fire. In an instant panic spread through the places where gringos were hiding, dragging their feet and bent over by their neighbors, and the panic became a dragon’s tail as one compact wave ran against another which was spinning in the opposite direction to the direction of the others.  At nightfall the survivors were lying face down on the ground, covered with a compact universe of tiny yellow flowers, and the only animal that could think of after all was a maneater. They slept in rectangular arrangements, facing each other in silence. On Friday the same men slept in identical arrangements under the same palm roof, but one night they slept in the same place, under the same bed, and on Saturday they were on the point of perishing under the lash of death. By dawn, they had killed two birds. They had killed a mule and a calf. They each had killed a mule and a calf. It seemed impossible to imagine the number of possible consequences.

====================

====================

22

The sun had not shone on that part of the town for many years. On the following day, however, the inhabitants of Macondo woke up in a kind of angelic stupor that had them ringed by earrings, bracelets, and rings made of bone in order to guess distances and render aid in the building of the church. The inhabitants of Macondo who stayed in the Community until the end of the year 1894 were on the verge of forgetting their sense of social well-being because they could not sleep and felt tormented by the notion of parchments rotting with the irremediable plague of insomnia. José Arcadio Buendía, without giving up his science, continued his work as if it were the only thing left in the whole town, the decisive in that respect owing not to the natural forces but to the supernatural proliferation of the village. 

======================

Categories
Computational Approaches to Narrative

Bitsy- Time is a garden of memories

I really enjoyed the overall dynamic around Bitsy. A browser-based game development platform with limited processing power manages to give ample room for narrative development. It also reminded me of a MMORPG platform I used to play around with when I was younger. It had a similar general aesthetic. UPDATE: It’s still online! Check it out: Byond.

My story was inspired by the book “The Order of Time” by Carlo Rovelli. You can play it or see the video below.

Bitsy UI capture
Bitsy UI capture
My Bitsy Game

Repository with game file: https://github.com/lacouture100/ITP-Computational-Approaches-to-Narrative/tree/main/Bitsy

I also urge you too check out these other bitsy games:

Categories
Computational Approaches to Narrative

Twine Assignment – Adapting a story to Twine

[CURRENTLY UPDATING]

I decided to take the story “Other People” written by Neil Gaiman, whose short stories I enjoy tremendously. The original site where I grabbed the story itself can be found here. I am also attaching it at the end of this post.

Methodology

At first, I dissected the story into sections I considered more straightforward to “trace” a narrative path through. My initial idea was to follow the story’s original structure: It would end in a loop. In order to start the process, I used the Miro app to start a visual layout. Something that would get me conceptually closer to how Twine lays out its nodes.

Full layout of the Story.
Zoom in onto one of the blocks I fragmented from the main story.
  • I changed the ‘he’ and ‘him’ pronouns to ‘you’
  • I also changed the style minimally, adding an ‘Open Sans’ font and changing the color palette.
  • Some links appear in the middle of the description of the torture, they will take you through memory, and sometime later one of them will bring you back to the pain.

Result:

Other people – Neil Gaiman.html

To be honest, I first started exploring the path of generative text with Twine. I went through a long and extensive rabbit hole which by the time I got out, the assignment was due and the scripts weren’t really working the way I wanted.

It was probably a matter of dedicating more time to the documentation and the forums.

Generative trail

KEYWORDS: blacked out poetry, and generative text, substitution.


<<nobr>>
	<<for _1 to 0; _i < 500; _i++>>
	<<set _randomCharacter to random(32,126)>>
	<<print String.fromCharCode(_randomCharacter)>>
	<</for>>
<</nobr>>

“Other People” by Neil Gaiman

“Time is fluid here,” said the demon. He knew it was a demon the moment he saw it. He knew it, just as he knew the place was Hell. There was nothing else that either of them could have been.

The room was long, and the demon waited by a smoking brazier at the far end. A multitude of objects hung on the rock-gray walls, of the kind that it would not have been wise or reassuring to inspect too closely. The ceiling was low, the floor oddly insubstantial.

“Come close,” said the demon, and he did. The demon was rake-thin, and naked. It was deeply scarred, and it appeared to have been flayed at some time in the distant past. It had no ears, no sex. Its lips were thin and ascetic, and its eyes were a demon’s eyes: they had seen too much and gone too far, and under their gaze he felt less important than a fly.

“What happens now?” he asked.

“Now,” said the demon, in a voice that carried with it no sorrow, no relish, only a dreadful flat resignation, “you will be tortured.”

“For how long?”

But the demon shook its head and made no reply. It walked slowly along the wall, eyeing first one of the devices that hung there, then another. At the far end of the wall, by the closed door, was a cat o’ nine tails made of frayed wire. The demon took it down with one three-fingered hand and walked back, carrying it reverently. It placed the wire tines onto the brazier, and stared at them as they began to heat up.

“That’s inhuman.”

“Yes.”

The tips of the cat’s tails were glowing a dead orange.

As the demon raised his arm to deliver the first blow, it said, “In time you will remember even this moment with fondness.”

“You are a liar.”

“No,” said the demon. “The next part,” it explained, in the moment before it brought down the cat, “is worse.” Then the tines of the cat landed on the man’s back with a crack and a hiss, tearing through the expensive clothes, burning and rending and shredding as they struck and, not for the last time in the place, he screamed.

There were 211 implements on the walls of that room, and in time he was to experience each of them. When, finally, the Lazarene’s Daughter, which he had grown to know intimately, had been cleaned and replaced on the wall in the 211th position, then, through wrecked lips, he gasped, “Now what?”

“Now,” said the demon, “the true pain begins.”

It did.

Everything he had ever done that had been better left undone. Every lie had told – told to himself, or told to others. Every little hurt, and all the great hurts. Each one was pulled out of him, detail by detail, inch by inch. The demon stripped away the cover of forgetfulness, stripped everything down to truth, and it hurt more than anything.

“Tell me what you thought as she walked out of the door,” said the demon.

“I thought my heart was broken.”

“No,” said the demon, without hate, “you didn’t.” It stared at him with expressionless eyes, and he was forced to look away.

“I thought, now she’ll never know I’ve been sleeping with her sister.”

The demon took apart his life, moment by moment, instant to awful instant. It lasted a hundred years, perhaps, or a thousand – they had all the time there ever was, in that grey room – and toward the end he realised that the demon had been right. The physical torture had been kinder.

And it ended.

And once it had ended, it began again. There was a self-knowledge there he had not had the first time, which somehow made everything worse.

Now, as he spoke, he hated himself. There were no lies, no evasions, no room for anything except the pain and the anger.

He spoke. He no longer wept. And when he finished, a thousand years later, he prayed that now the demon would go to the wall, and bring down the skinning knife, or the choke-pear, or the screws.

“Again,” said the demon.

He began to scream. He screamed for a long time.

“Again,” said the demon, when he was done, as if nothing had been said.

It was like peeling an onion. This time through his life he learned about consequences. He learnt the results of things he had done; things he had been blind to as he did them; the ways he had hurt the world; the damage he had done to people he had never known, or met, or encountered. It was the hardest lesson yet.

“Again,” said the demon, a thousand years later.

He crouched on the floor, beside the brazier, rocking gently, his eyes closed, and he told the story of his life, re-experiencing it as he told it, from birth to death, changing nothing, leaving nothing out, facing everything. He opened his heart.

When he was done, he sat there, eyes closed, waiting for the voice to say, “Again.”, but nothing was said. He opened his eyes.

Slowly he stood up. He was alone.

At the far end of the room, there was a door, and as he watched, it opened.

A man stepped through the door. There was terror in the man’s face, and arrogance, and pride. The man, who wore expensive clothes, took several hesitant steps into the room, and then stopped.

When he saw the man, he understood.

“Time is fluid here,” he told the new arrival.

Categories
Computational Approaches to Narrative

Twine 01 – Story Generation using Twine

(NOTE: You can check out some of the reading annotations I made for this week through this link)


This week’s sketch involved getting to know the Twine software. Twine is an open-source tool for telling interactive, nonlinear stories. After reading about it in Janet Murray’s Hamlet in the Holodeck I had been waiting for the opportunity to explore the tool. Allison’s class fortunately presented the chance for me in the form of an assignment. The following test sketch was made following Allison Parrish’s Twine tutorial. The tutorial covers several aspects of Twine, including the use of expressions in order to make things interactive. The tutorial also introduces the SugarCube story format, which provides its own API for creating expressions. To dive further into that I looked into SugarCube’s documentation.

Create a system for generating stories.

My first story with twine

Admittedly, I did not expect to enjoy using this software so much. Even though I am a fan of node-based software, my first impression made me think it probably would not allow for much customization. However, after looking more into the documentation, I realized expressions gave the possibility to make any number of combinations.

At first, I wanted to just create a structure following one of the motifs Sam Ashwell provides in this informative blog post. But I decided against, rather going for a more story-based walkthrough than a pattern-based structure. In any case, you can see how it ended up looking like with Twine’s preview below:

Twine test story gif.
Twine test story gif.

Below you can find each of the blocks used for the above structure to work.

Twine test story structure.
Twine test story structure.
Twine test story first block
Twine test story first block
Twine test story second block
Twine test story second block
Twine test story third block
Twine test story third block
Twine test story fourth block
Twine test story fourth block
Twine test story fifth and last block
Twine test story fifth and last block

Hope you enjoyed! Thanks for reading.

Categories
Computational Approaches to Narrative

Sketch 01 – Story Generation System

The instructions for this week’s sketch involve the following:

Create a system for generating stories.

  • The system should be based on some kind of formalism or abstraction about narrative—maybe one that you read about in the reading, or maybe one that you’ve devised yourself.
  • Be weird and opinionated.
  • Your system should provide a set of instructions to follow (or an interface to interact with), and at the end produce some kind of story.
  • The system should be expressive, i.e., following the instructions multiple times should produce noticeably different stories.

Phytomorphologic narrative system

The graphs and illustrations shown below were made using Miro. You can follow along with the board I made following this link.

Image explaining the Phytomorphologic narrative system.
  • First, I don’t consider the system as something that defines one standard narrative structure. I’d rather think of it as a way to create different narratives using metaphors already present in our world. In this case, our metaphors will be inspired by plant morphology.
  • Specifically, we use the shape of a plant to define how to tell the story of a person’s life. The health of the leaves, the number of nodes, and the degrees of separation between them define the structure to follow while telling it.
  • The system is based on the idea of several events that compose a longer narrative structure. Each of these compact and definable events is seen from the perspective of an entity (or character) in the story. As I will explain in a moment, each of these events may also fragment into the perspectives of different entities, while still pertaining to the internal time of the story.

Instructions

  1. Look for a plant with leaves. Hopefully, it will have several stems, with smaller stems and leaves protruding from it. Something like the image below is what I chose in this case.
  2. Make a 2D representation of it. I chose to draw it.
2D representation of the plant I chose.

3. Identify the start and end of the plant/ plant section you chose. Count the number of nodes, leaves, and tips. Each of these will correspond to different elements in the narrative structure. You can see an example below:

Finding the tips, nodes, sub-nodes, and beginning/end of the Story.

4. Consider the main stem of your plant as the total internal time of the story. Each node in the main stem is an event or micro-narrative that begins at that precise moment in the timeline of the story. I have identified them with red dots in the image above.

5. The number of leaf or stem tips on the plant determines the number of entities(characters) in the story. One event, or stem, might have several bifurcations that correspond to these individual entities.

6. An event derived from a node in the main stem means it is being told by someone/something in the first degree of relationship (Immediate Family, partner, offspring, etc. A sub-node inside the event indicates the second degree of relationship with the main character or the first degree of relationship with the character in the secondary stem.

7. The health of each of the appendages also determines the sentiment in which the narrative discourse is formed. An unhealthy stem and leaf set a different emotional setting than a healthy one in terms of how the story is being told.

Story events generation.