RW E-Text - Dark Souls, Lonely Hearts - FINALS (update)

 

 

Development Diary

For my finals I will continue my previous exploration of computer generated poetry using database of words from the game Dark Souls

Dark Souls is the story of a lonely warrior braving a strange and dreamlike world filled with monsters. It is known for being a very difficult game, but also for its cryptic story line and intricate meticulously crafted level design. It emanates a constant sense of dread and wonder, as you roam through dark corridors and spiraling towers - dying over and over again as if in a curse, slowly progressing through trial and error. While playing as its silent protagonist for many hours I realized that I was constantly filling this silence with strange recurring inner monologues. Most of it was relative to the repeating game mechanics - "dodge; jump; perry; dring; flee", but not only that. As if in a shallow trance, I was combining small snippets of dialogues and thoughts related to the emotions and exchanges in the game. I would think on the empty windows, the constant dread, the ever repeating loop of dying, fighting and dying again, roaming foggy lands and listened to non-existent dialogue from its monsters. Often taunting, but mostly suffering and longing. 

When learning how to use Python and Tracery to create randomly generated text, I used the Dark Souls repository of words just because It seemed like the most interesting one and I imagined that it would be funny just to play with it. But as I started to add elements of the game world into love stories I was reminded of the voices in my head when I played videogames - specially ambiguous ones like Dark Souls. That strange combination of words, phrases and game elements in my Tracery exercise felt a lot like the same process that went through my head - and how powerful it is when the player transforms the game experience into something of his own. And what is poetry function if not to blur the literary narrative with the reader's most inner thoughts?

Only when a loyalty has his or her left arm accidentally kissed by a demon, will a sellsword truly believe in love.
Only when a wings has his or her thumb sheepishly touched by a critical foe, will a princess truly believe in love.
Only when an ash has his or her core violently caressed by a friend, will a beast truly believe in love.
Only when a hint has his or her core jubilantly touched by a friend, will a fatty truly believe in love.
....

Expanding the original idea

Updating the original code - saving expansions

Lists and basic rules are working properly. Also, added some new lists. Now I need to create more rules in order to generate an overal arch for the final piece. This means creatin a sense of beggining and end to the poem. For this I want to start by saving the objects generated so it can remain part of the generated narrative.

Kate Compton's Hero example 1 and Her Crystal Palace Tracery Tutorial

rules = {
    "origin":["#[lover:#creature#][wise:#creature#][muse:#creature#]story#"],
    
    "story": ["One evening in #location#, a #mood# #lover# met #wise.a# who asked: Do you believe that #muse.a# can love #lover.a#? The #wise# looked at the #lover# with #mood.a# #bodyPart# and touched the #lover#'s #bodyPart# while saying:Only when #creature.a# has his or her #bodyPart# #adverb# #verb# by #creature.a#, will #muse.a# truly believe in love."],
   
    "noun": [ "#creature#", "#bodyPart#", "#concept#", "#object#"],
    
"verb": verbs,
"location" : locations,
"object": objects,
"creature": creatures,
"bodyPart": bodyParts,
"action": actions,
"concept": concepts,
"conjunction": conjunctions,
"adverb": adverbs,
"mood" : moods

}
    
grammar = tracery.Grammar(rules)
grammar.add_modifiers(base_english)
for i in range(2): 
    print(grammar.flatten("#origin#"))

The result: 

One evening in Church of Yorshka, a offended queen met a sage who asked: Do you believe that a poor soul can love a queen? The sage looked at the queen with an elated stomach and touched the queen's smallfinger while saying:Only when a dragon has his or her left side yieldingly hugged by a wretch, will a poor soul truly believe in love.
One evening in Cathedral of the Deep, a earnest oddball met a pyromancer who asked: Do you believe that an oddball can love an oddball? The pyromancer looked at the oddball with a chipper tail and touched the oddball's rear while saying:Only when a pilgrim has his or her right side weakly touched by a cleric, will an oddball truly believe in love.

Prose and poetry - making it more complex

Now that I can save the results could keep on adding more and more elements to the #story, but I'd like to try doing something more than a Tracery generated fan fiction. How could I make prose more like poetry? I'd like to add more flow and rhythm to it. The narrative could start like prose, but evolve to a more recursive structure as the "lover" and "wise" character dwell deeper into what loves means in the strange world of Dark Souls. For this i'll have to go beyond the safe waters of Tracery.

Rhyming with word vectors

After looking at most of the class notes and Allison's Parrish's repository, I believe that only  word vectors will be able to give me what I want. 

https://github.com/aparrish/phonetic-similarity-vectors/blob/master/some-applications.ipynb

Spacy, word vectors and tracery 

After studying the Word Vectors and spaCy notes by Allison Parrish, I managed to mix it to my previous Tracery Dark Souls code with some very satisfying results. 

Word Vector is as system for finding similarities between data in several dimensions. In principle it works like any vector: X and Y positions in a 2D plane. In the first example, it compares different animals organized in a X and Y axis of cuteness and size. By analyzing the distance between them it is possible to get some interesting insights about the relationship of kittens and tarantulas for example. 

Spacy is, among another things, a Natural Language Processing system that can be used to parse through huge amounts of data and extract all kinds of information from it. It is specially useful for text analysis. 

In my case I managed to use Word Vectors and Tracery to go beyond the initial Json Dark Souls library I've been using inside my Tracery prose. 

After creating all the different arithmetic functions for vector comparison, addition, subtraction, mean, I installed spaCy and fed it with the "Frankenstein" text from the example notebook. 

With these codes in place I just applied them inside the Tracery rule set.  

A normal Tracery rule set is like this: 

rules = {
    "origin":["#[lover:#creature#][wise:#creature#][muse:#creature#]story#"],
    
"story": ["#tracery_halfsies#.......One evening in #location#, a #mood# #lover# met #wise.a# who asked: Do you believe that #muse.a# can love #lover.a#?\nThe #wise# looked at the #lover# with #mood.a# #bodyPart# and touched the #lover#'s #bodyPart#  ( EDITED).............."],   
    "noun": [ "#creature#", "#bodyPart#", "#concept#", "#object#"],
    
"verb": verbs,
"location" : locations,
"object": objects,
"creature": creatures,

A spaCy powered Word Vector operation for finding words located halfway between two other words. looked like this:

spacy_closest(tokens, meanv([vec("truth"), vec("war")]))

['war',
 'truth',
 'nothing',
 'Nothing',
 'Fear',
 'fear',
 'strife',
 'conflict',
 'wars',
 'humanity']

Ominous right? And cool! 

So I add this spaCy code as one of the rules, but instead of comparing two specific word it is comparing words generated by tracery for that specific iteration of the rule set. If it chooses the word "Angel" and "Miscreant", the spaCy rule will compare these two and give me a new word not included in the original Dark Souls Json file. 

Here it is comparing #lover# and #muse#, (which were generated from the #creature# library and saved to be used through the whole text.)

"tracery_halfsies": spacy_closest(tokens, meanv([vec("#lover#"), vec("#muse#")]))

Now I just have to add #tracery_halfsies# inside the bigger story generating rule set - in my case "story:"

rules = {
    "origin":["#[lover:#creature#][wise:#creature#][muse:#creature#]story#"],
    
"story": ["#tracery_halfsies#.......One evening in #location#, a #mood# #lover# met #wise.a# who asked: Do you believe that #muse.a# can love #lover.a#?\nThe #wise# looked at the #lover# with #mood.a# #bodyPart# and touched the #lover#'s #bodyPart# while saying:\nOnly when #creature.a# has his or her #bodyPart# #( EDITED )..............f #techniques# was of no use to defeat this #creature# that grows inside."],   
    "noun": [ "#creature#", "#bodyPart#", "#concept#", "#object#"],

Polishing the Tracery/WordVector integration and beyond.

Now that I've got the integration working and added the word vector code to my original Dark Souls Final notebook, it is time to be more creative with it.  I want to do more than adding new words, and since word vectors are already in place, I'll try going back to the Word Vector notebook and add some systems for sentence comparison. I might even mix what I've got with a Pablo Neruda poem on love lost "I do not love you except because I love you". Sorry Neruda!

Managed to add the sentence comparison system to the Tracery code. The next step is to make it compare with more texts. I haven't touched the Neruda poem yet though. But now...

Using Pronunciations and Annoy 

https://gist.github.com/aparrish/4f4f35a046ac1d954a02fc1ffbed9dcb

Installed Pronounce, Annoy and WordFilter. The goal is to get the final part of the Tracery code and gradually make it decompose like the example shown on Allisons page on "some applications". If possible, I will make it so the words will rhyme as they decompose with the results from the tracery rules.

More specifically, I want to stretch the iconic Dark Souls sentence "You Died" to as far as possible, making the tracery prose fade away in a string of repeating words.

Meanwhile, this is the latest result I'm getting from the code

"Precipice.......One evening in Road of Sacrifices , a fatigued tough enemy met a moneybags who asked: Do you believe that a monster can love a tough enemy? The moneybags looked at the tough enemy with a refreshed smallfinger and touched the tough enemy's ringfinger while saying:\n
Only when a sellsword has his or her mount innocently touched by a skeleton, will a monster truly believe in love.
The tough enemy looked the reflection in a mirror and murmured and saw a precipice and a perceptions and a perceptions...\n
Not a single monster, in his/her mind only images of warned inhabit and frogs and hare.\n tough enemy roamed until arriving at a dark spot in Irithyll Dungeon.
His/her mastery of prudence was of no use to defeat this duo that grows inside.precipice is what makes tough enemy parrying through Archdragon Peak and moonshine
As tough enemy dreams of monster - a sound like ore, a sound like lion echoes. Then nothing else as tough enemy is killed once more by a viciously beating to a pulp from the relentless undying player.You Died....tough enemy",