Computational Approaches to Narrative: Narrative Decomposition of Cinderella

Posted on
catn narrative computational-approaches-to-narrative

Tracery is a tool for text expansion. Its primary interface is through passing it a JSON specification.

Specifying the parts of a narrative

The tracery specification is very flexible and unopinionated. A hello world would look like

{"origin": "hello, world"}

It would always return the same string, “hello, world”. The next step in complexity would be adding a substitution with an array of possible values,

{"origin": "hello, #name#", "name":["earth", "moon"]}

Here, you might either get "hello, earth" or "hello, moon".

Structuring narrative subcomponents

The name of the rules being added are arbitrary, so it up to you to organize the structure of your narrative artifact generator.

In class, we are using the following frame to discuss narratives:

narrative = story([storyworld, plot]).discourse(chonology, pov, style).artifact()

I tried to keep this model in mind as I built a Cinderella grammar.

Most of my grammar is dedicated to the storyworld and plot. It is handling the various roles and events in a Cinderella story.

Most of the discourse is embedded into two story options, one sympathetic to the protagonist and one skeptical of the protagonist’s intentions.

I only wrote a second discourse option after setting up the story elements and surprised by how easy it was to setup in addition to the first.

You can see the full grammar the bottom of this post.

Next Steps

  • Take advantage of preexisting data sources to generate more complex grammars
  • Interactively generated grammars
  • Clearer organization of subcomponents

Appendix: Full Grammar

const grammarSource = {
  origin:  "#[#setProtagonist#][#setPromisedLand#][#savior#]story#",
  story:[
    "#storyWorld#\n#badTime# and it seemed beyond reach. By chance, #rise#, but #secondFall#. #subjective.capitalize# went back to #possesive# previous life and once again #badTime#. #resolution#",
    "#name# was a good-for-nothing. #subjective.capitalize# tricked #savior# to get #objective# #promisedThing.a# #connectPromise# #promisedPlace#. Of course, #subjective# makes a huge mistake and loses everything. Still, somehow #name.capitalize# still cons #gatekeeper# at the #promisedPlace# to bring #objective# back to the #promisedPlace#."
  ],
  setProtagonist: [
    "[name:Cinderella][subjective:she][possesive:her][objective:her]",
    "[name:Charlie][subjective:he][possesive:his][objective:him]",
    "[name:Holden][subjective:he][possesive:his][objective:him]",
    "[name:Adam and Eve][subjective:they][possesive:their][objective:them]",
  ],
  setPromisedLand: [
    "[promisedThing:tour][promisedPlace:the magical factory][connectPromise:of][gatekeeper:Willy Wonka]",
    "[promisedThing:invitation][promisedPlace:the fanciest party][connectPromise:to][gatekeeper:the prince]",
    "[promisedThing:internship][promisedPlace:the richest company][connectPromise:at][gatekeeper:a hiring manager]",
  ],
  storyWorld: "#name.capitalize# was pitiful. #[subjective:#subjective#][possesive:#possesive#]fall#. #subjective.capitalize# had since fallen on hard times. #name.capitalize# dreamed of #promisedThing.a# #connectPromise# #promisedPlace#, but",
  fall: ['#subjective.capitalize# had lost #possesive# family in an accident', '#subjective.capitalize# had been taken advantage of by a predatory money lender'],
  badTime: [
    'worked tirelessly as a servant', 
    'was destitute'
  ],
  savior: [
    "[savior:Jesus]",
    "[savior:Willy Wonka]",
    "[savior:a fairy godmother]",
    "[savior:an unnamed old man]",
  ],
  rise: "#savior# got #name.capitalize# #promisedThing.a# #connectPromise# #promisedPlace#",
  favors: [
    'helped #protag.capitalize# get into a fancy party', 
    'took #protag.capitalize# on a tour of their operational facility'
  ],

  secondFall: "#name.capitalize# did the one thing #savior# told #objective# not to do, #rules#",
  rules:["was akward", "stole", "came home after midnight"],
  resolution: "However, #gatekeeper# recognized #name.capitalize#\'s inner virtue while they were at the #promisedPlace#. #gatekeeper.capitalize# sought out #name# brought them back to #promisedPlace#."
};