<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>nlg &middot; Arguable Intelligence</title><link>https://ojmason.net/tags/nlg/</link><description>Personal musings on computational linguistics, AI, sailing, and generated fiction.</description><language>en-gb</language><managingEditor>Oliver Mason</managingEditor><webMaster>Oliver Mason</webMaster><lastBuildDate>Thu, 16 Aug 2018 15:47:04 +0100</lastBuildDate><atom:link href="https://ojmason.net/tags/nlg/index.xml" rel="self" type="application/rss+xml"/><item><title>Conceptual Storytelling</title><link>https://ojmason.net/conceptual-storytelling/</link><guid isPermaLink="true">https://ojmason.net/conceptual-storytelling/</guid><pubDate>Thu, 16 Aug 2018 15:47:04 +0100</pubDate><category>nanogenmo</category><category>nlg</category><category>narrative</category><description>While on holiday I finally have the energy to do a bit more work on my NaNoGenMo project, which of course is far too ambitious for a single month. At the moment I&rsquo;m doing a bit more work on generating natural language text from an internal formal representation, conceptual dependency. Here you have a set of semantic primitives that are turned into English (or any other language, eventually). The idea is that the computer manipulates a simulated world, producing a list of such statements, which are then rendered into text.</description><content:encoded><![CDATA[<p>While on holiday I finally have the energy to do a bit more work on my <a href="https://nanogenmo.github.io/">NaNoGenMo</a>
project, which of course is far too ambitious for a single month. At the moment I&rsquo;m doing a bit more work on
generating natural language text from an internal formal representation, <a href="https://en.wikipedia.org/wiki/Conceptual_dependency_theory">conceptual
dependency</a>. Here you have a set of semantic primitives
that are turned into English (or any other language, eventually). The idea is that the computer manipulates a
simulated world, producing a list of such statements, which are then rendered into text.</p>
<p>To practice working above sentence level I have tried encoding a fable (<a href="http://aesopfables.com/cgi/aesop1.cgi?1&amp;TheAntandtheDove&amp;&amp;antdove2.ram">The Ant and the Dove</a>)
in the right format. Not too tricky after a bit of thought: you need to first rephrase the sentences as a set of
simple propositions using the primitives, and then translation is not too hard. Also, replace the <em>picture producers</em>
(ie noun groups) by a set of entities that can be easily referred to by id value throughout.</p>
<p>Here is the original fable:</p>
<blockquote>
<p>The Ant and the Dove</p>
<p>AN ANT went to the bank of a river to quench its thirst, and
being carried away by the rush of the stream, was on the point of
drowning.  A Dove sitting on a tree overhanging the water plucked
a leaf and let it fall into the stream close to her.  The Ant
climbed onto it and floated in safety to the bank.  Shortly
afterwards a birdcatcher came and stood under the tree, and laid
his lime-twigs for the Dove, which sat in the branches.  The Ant,
perceiving his design, stung him in the foot.  In pain the
birdcatcher threw down the twigs, and the noise made the Dove
take wing.</p>
<p>One good turn deserves another</p>
</blockquote>
<p>And, after some (minor) simplification, this is the fable in conceptual dependency format &ndash; a list
of Lisp/Scheme expressions with the semantic primitives and their arguments:</p>
<pre tabindex="0"><code>((pp (class being)
     (label &#34;ant&#34;)
     (id 0)
     (features animal)
     (type &#34;ant&#34;))
 (pp (class location) (label &#34;river bank&#34;) (id 1))
 (pp (class location) (label &#34;river&#34;) (id 2))
 (pp (class being)
     (label &#34;dove&#34;)
     (id 3)
     (features animal can-fly)
     (type &#34;dove&#34;))
 (pp (class object)
     (label &#34;leaf&#34;)
     (id 4)
     (features plant)
     (type &#34;leaf&#34;))
 (pp (class being)
     (label &#34;bird catcher&#34;)
     (id 5)
     (features human)
     (type &#34;human&#34;))
 (pp (class location) (label &#34;tree&#34;) (id 6))
 (pp (class object)
     (label &#34;trap&#34;)
     (id 7)
     (type &#34;trap&#34;))
 (pp (class object)
     (label &#34;water&#34;)
     (features liquid edible)
     (id 9))
 (thirsty (actor (pp (id 0))))
 (plan (actor (pp (id 0)))
       (object
         (ingest (actor (pp (id 0))) (object (pp (id 9))))))
 (ptrans
   (actor (pp (id 0)))
   (object (pp (id 0)))
   (to (pp (id 1))))
 (ptrans
   (actor gravity)
   (object (pp (id 0)))
   (from (pp (id 1)))
   (to (pp (id 2))))
 (loc (actor (pp (id 0))) (val (pp (id 2))))
 (loc (actor (pp (id 3))) (val (pp (id 6))))
 (loc (actor (pp (id 6)))
      (val (above (pp (id 2)))))
 (loc (actor (pp (id 4))) (val (pp (id 6))))
 (grasp (actor (pp (id 3))) (object (pp (id 4))))
 (grasp (actor (pp (id 3)))
        (object (pp (id 4)))
        (mode (tf)))
 (ptrans
   (actor gravity)
   (object (pp (id 4)))
   (from (pp (id 6)))
   (to (pp (id 2))))
 (loc (actor (pp (id 4))) (val (pp (id 2))))
 (ptrans
   (actor (pp (id 0)))
   (object (pp (id 0)))
   (from (pp (id 2)))
   (to (pp (id 4))))
 (ptrans
   (object (pp (id 4)))
   (from (pp (id 2)))
   (to (pp (id 1))))
 (ptrans
   (actor (pp (id 0)))
   (object (pp (id 0)))
   (from (pp (id 4)))
   (to (pp (id 1))))
 (like (actor (pp (id 0))) (to (pp (id 3))))
 (loc (actor (pp (id 5))) (val (pp (id 1))))
 (loc (actor (pp (id 3))) (val (pp (id 6))))
 (plan (actor (pp (id 5)))
       (object
         (grasp (actor (pp (id 5))) (object (pp (id 3))))))
 (grasp (actor (pp (id 5))) (object (pp (id 7))))
 (mtrans
   (actor (pp (id 0)))
   (object (pp (id 5)))
   (from eye)
   (to memory))
 (mloc (actor (pp (id 0)))
       (object
         (plan (actor (pp (id 5)))
               (object
                 (grasp (actor (pp (id 5))) (object (pp (id 3))))))))
 (like (actor (pp (id 0)))
       (to (pp (id 5)))
       (mode (neg)))
 (propel (actor (pp (id 0))) (to (pp (id 5))))
 (health (actor (pp (id 5))) (val 3))
 (grasp (actor (pp (id 5)))
        (object (pp (id 7)))
        (mode (tf)))
 (mtrans
   (actor (pp (id 3)))
   (object
     (grasp (actor (pp (id 5)))
            (object (pp (id 7)))
            (mode (tf))))
   (from ear)
   (to memory))
 (mloc (actor (pp (id 3)))
       (object
         (plan (actor (pp (id 5)))
               (object
                 (grasp (actor (pp (id 5))) (object (pp (id 3))))))))
 (ptrans
   (actor (pp (id 3)))
   (object (pp (id 3)))
   (from (pp (id 6)))))
</code></pre><p>The most common primitive is <code>ptrans</code>, which is a physical transfer, either moving or going, depending on whether
the actor and the object are the same thing. Then, <code>loc</code> describes the location of something, and <code>mloc</code> is about
thinking.</p>
<p>So, what do we do with this? The first step is to put this back into (English) prose. This is done with a program
based on an old module called <em>mumble</em>. It takes as input a list of CD structures (as above) and puts out English
sentences. Depending on the primitive and certain features of the actor and object, an appropriate verb and
sentence structure is chosen. After some minor tweaking we get the following output:</p>
<blockquote>
<p>The ant is thirsty.
The ant plans to drink water.
The ant goes to the river bank.
The ant falls from the river bank into the river.
The ant is in the river.
The dove is in a tree.
A tree is in the river.
A leaf is in a tree.
The dove picks up a leaf.
The dove lets go of a leaf.
A leaf falls from a tree into the river.
A leaf is in the river.
The ant goes to a leaf.
A leaf goes to the river bank.
The ant goes to the river bank.
The ant likes the dove.
The bird catcher is on the river bank.
The dove is in a tree.
The bird catcher plans to pick up the dove.
The bird catcher picks up a trap.
The ant sees the bird catcher.
The ant thinks that the bird catcher plans to pick up the dove.
The ant does not like the bird catcher.
The ant strikes the bird catcher.
The bird catcher is somewhat ill.
The bird catcher lets go of a trap.
The dove hears that the bird catcher lets go of a trap.
The dove thinks that the bird catcher plans to pick up the dove.
The dove leaves from a tree.</p>
<p>END</p>
</blockquote>
<p>There are several ways to make this more &rsquo;natural&rsquo; and less computery. At first we need to look at definite/indefinite:
we always say <em>the ant</em>, and <em>the dove</em>, as if there was only one. Ideally we would want <em>an ant</em> and <em>a dove</em>, at
least until they have been mentioned once. After that we switch to the definite article to refer back to the particular
animal. And pronouns would be good.</p>
<p>Still lots of scope for improvement!</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 7</title><link>https://ojmason.net/nanogenmo-7/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-7/</guid><pubDate>Fri, 01 Dec 2017 22:29:24 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Know your limits. My next step was going to be the setting, ie the locations that I was going to use for my characters to wander around in. So, off I went to research procedurally generated maps. As it turns out, there is some great stuff out there, and one approach has even been used to generate a fantasy world atlas/travel guide for NaNoGenMo 2015. I duly downloaded the code, but of course it didn&rsquo;t work because of unresolved dependencies. I looked further, and found other nice examples, and then realised I&rsquo;ve gone down a rabbit hole. My main priority currently is to get something together that works, and procedurally generated maps with realistic climate models are not what I need to achieve that. Instead, I&rsquo;m currently using a very simple map borrowed from a multi-player version of the 80s computer game Lords of Midnight. The system is flexible enough that it just needs a basic ASCII version of a map, so if I later get a procedurally generated one in the right format, it should work fine. A routine picks out points of interest, like villages etc, and assigns them names.</description><content:encoded><![CDATA[<p>Know your limits. My next step was going to be the setting, ie the locations that I was going
to use for my characters to wander around in. So, off I went to research procedurally generated
maps. As it turns out, there is some great stuff out there, and one approach has even been used to generate
a <a href="https://mewo2.com/notes/terrain/">fantasy world atlas/travel guide</a> for NaNoGenMo 2015. I duly downloaded
the code, but of course it didn&rsquo;t work because of unresolved dependencies. I looked further, and found other
nice examples, and then realised I&rsquo;ve gone down a rabbit hole. My main priority currently is to get something
together that works, and procedurally generated maps with realistic climate models are not what I need to
achieve that. Instead, I&rsquo;m currently using a very simple map borrowed from a multi-player version of the
80s computer game <a href="https://en.wikipedia.org/wiki/The_Lords_of_Midnight">Lords of Midnight</a>. The system is
flexible enough that it just needs a basic ASCII version of a map, so if I later get a procedurally generated
one in the right format, it should work fine. A routine picks out points of interest, like villages etc, and assigns
them names.</p>
<p>Names are another rabbit hole, so for now I use a prefab list that I created using some on-line name generators.
I have a list of more names than I need, and just pick some randomly off there. Name generation is a sideshow for
later.</p>
<p>And, November is finished now. I don&rsquo;t actually have much to show, but have done a lot of reading and thinking
about what I want to do. I will quietly continue chipping away at it, and perhaps will have something working
by NaNoGenMo next year. So, more like NaNoGenYear!</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 6</title><link>https://ojmason.net/nanogenmo-6/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-6/</guid><pubDate>Fri, 24 Nov 2017 22:15:48 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Day 6 &ndash; but today is November 24th&hellip; this just serves to show how hard it is to combine a side project with a full-time job, a family, and other hobbies! The last two weekends I spent sailing at two all-weekend races (Northampton and Draycote), and in the evenings I am generally too busy with other things. And I don&rsquo;t want to &lsquo;pull an all-nighter&rsquo;, as it&rsquo;s not a sustainable way to do things. However, today I got a few things done:</description><content:encoded><![CDATA[<p>Day 6 &ndash; but today is November 24th&hellip; this just serves to show how hard it is to combine a side project
with a full-time job, a family, and other hobbies! The last two weekends I spent sailing at two all-weekend
races (Northampton and Draycote), and in the evenings I am generally too busy with other things. And I don&rsquo;t
want to &lsquo;pull an all-nighter&rsquo;, as it&rsquo;s not a sustainable way to do things. However, today I got a few things
done:</p>
<p>The central element of my project is a &lsquo;world simulator&rsquo;, in which the characters act out their desires, follow
their goals, and interact in (hopefully) interesting ways, which I will then harvest to generate a story from.
The core of the simulator is a planner: you feed in the characters&rsquo; goals, and they will then find a way of
doing what they need to do in order to achieve them. The planning algorithm I&rsquo;m using is called Goal Oriented
Action Planning (GOAP), basically a back-ward chaining algorithm: Starting from the goal, you work backwards
to see which actions get you to your goal. Each action has a post-condition (which would be matched to the
goal), and a pre-condition (which becomes the new goal). You select an action whose post-condition matches
some of the character&rsquo;s goal conditions, and then see how you get there. Each action also has a cost associated
with it, which allows you to choose a more efficient path in case there are several options.</p>
<p>I have today managed to implement a very basic version of that in Scheme. I&rsquo;m using atomic conditions, but
eventually will have more complicated expressions, but it is a first step. For several toy scenarioes the
planner does indeed find suitable solutions, which are paths through a network of states. Adjusting this to
the final world representation should not be too much of an issue.</p>
<p>I have resigned myself to not finishing this system by the end of the month. But I&rsquo;ve made a start, and will try
to get this continued throughout the year, so that I have a novel ready by NaNoGenMo 2018&hellip; On the positive side,
my Scheme programming is getting better, and I have loads of ideas about what to implement over the coming year.</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 5</title><link>https://ojmason.net/nanogenmo-5/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-5/</guid><pubDate>Tue, 07 Nov 2017 11:05:29 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Today just some minor implementations; a start on basic functions to maintain the world: add and update character information, etc. All rather mundane yet necessary stuff. More reading in Inside Computer Understanding by Schank and Riesbeck, and the realisation that I really have to cut down things if I want to get anything done by the end of the month. The more interesting part for me is the natural language generation, so I might have to give up on generating an interesting world in favour of more trivial events.</description><content:encoded><![CDATA[<p>Today just some minor implementations; a start on basic functions to maintain the world: add and update character
information, etc. All rather mundane yet necessary stuff. More reading in <em>Inside Computer Understanding</em> by
Schank and Riesbeck, and the realisation that I really have to cut down things if I want to get anything done by
the end of the month. The more interesting part for me is the natural language generation, so I might have to give up
on generating an interesting world in favour of more trivial events.</p>
<p>I think back with sentimental feelings to the days of being a student &ndash; no job, no family, but lots of spare time
to work on interesting stuff like this. I think that is the real benefit of a university education: the freedom to
research pet projects!</p>
<p>In order to make it worthwhile, I will develop the world simulator in a modular way, so that more complexity
can always be added in later on. New plans or goals, new actions, or whatever else is required to make it more
realistic. I might end up with a version of the Sims&hellip; but with a narrative text interface, rather than a graphical
one. Let&rsquo;s see how far I get.</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 4</title><link>https://ojmason.net/nanogenmo-4/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-4/</guid><pubDate>Sun, 05 Nov 2017 23:25:33 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Today is only day 4, as I was too busy to do anything on the project yesterday. I spent a bit more time on emotions, exploring the Wheel of Emotions in a bit more detail. Implementation-wise I made a start on the module that generates and handles characters. From the wheel of emotions it is possible to derive a number of secondary emotions, and as I use emotion &lsquo;coordinates&rsquo; to evaluate the stance of a character towards other characters, this should allow for a decent modelling of interpersonal relations. I&rsquo;m still not sure how this will influence decision making. There will probably have to be some evaluation function which assigns a numerical score to each option, and that will be modified by the stance of the character towards any affected characters, and also the character&rsquo;s own current emotional state. If they are furious, they might actually choose an irrational option that harms themselves.</description><content:encoded><![CDATA[<p>Today is only day 4, as I was too busy to do anything on the project yesterday. I spent a bit
more time on emotions, exploring the <a href="https://en.wikipedia.org/wiki/Contrasting_and_categorization_of_emotions#Plutchik.27s_wheel_of_emotions">Wheel of Emotions</a>
in a bit more detail. Implementation-wise I made a start on the module that generates and handles characters.
From the wheel of emotions it is possible to derive a number of secondary emotions, and as I use
emotion &lsquo;coordinates&rsquo; to evaluate the stance of a character towards other characters, this should
allow for a decent modelling of interpersonal relations. I&rsquo;m still not sure how this will influence
decision making. There will probably have to be some evaluation function which assigns a numerical
score to each option, and that will be modified by the stance of the character towards any affected
characters, and also the character&rsquo;s own current emotional state. If they are furious, they might
actually choose an irrational option that harms themselves.</p>
<p>When rendering this as a story, it might be worth looking at state changes, and possibly to add changes
to emotional states as annotations to any activities that are going on, so that we can generate text like
<em>A did some action, and it filled B with anger.</em> or <em>A was overjoyed to see B again.</em> &ndash; obviously, it
is always better to describe emotional states indirectly where possible, but that seems to hard for now.</p>
<p>Given how little time I can devote to the project, I think I will have to scale it down a bit if I want to
have anything ready by the end of the month. I might always try to continue working on it afterwards for
the more ambitious &lsquo;stretch goals&rsquo;.</p>
<p>On the to-do list now is the representation of world knowledge, both the objective &rsquo;truth&rsquo; and the characters&rsquo;
individual views of it. Then the world simulator/planner, and then a few basic aims. At that point I should
have a simple TaleSpin working, which I can extend with more details. I would then add more aims and actions to it as I go
along, and start work on the routine to generate the story from the world log, and finally the verbalisation,
which will be a slightly more sophisticated clone of Mumble.</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 3</title><link>https://ojmason.net/nanogenmo-3/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-3/</guid><pubDate>Fri, 03 Nov 2017 17:41:28 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Now that I have a basic (abstract) plot outline and some idea about the characters&rsquo; emotions, I need to think about what drives them. Yesterday I listed some aims that the system would understand. So, each character gets a set of initial aims that they are trying to achieve. Ideally there would be some conflict built in, for example a love interest: two separate characters want to fall in love with the same person. As they attempt to win that person&rsquo;s heart, they might clash. Or, decide to live in an open relationship together as a triple, who knows!</description><content:encoded><![CDATA[<p>Now that I have a basic (abstract) plot outline and some idea about the characters&rsquo; emotions,
I need to think about what drives them. <a href="/blog/nanogenmo-2/">Yesterday</a> I listed some aims that
the system would understand. So, each character gets a set of initial aims that they are trying to
achieve. Ideally there would be some conflict built in, for example a love interest: two separate
characters want to fall in love with the same person. As they attempt to win that person&rsquo;s heart,
they might clash. Or, decide to live in an open relationship together as a triple, who knows!</p>
<p>That would also make it easy to implement some of <a href="/blog/nanogenmo-1/">Propp&rsquo;s functions</a>: the
<em>interdiction</em> would mean that the hero is told one of his aims is not allowed. And the <em>interdiction-violation</em>
would mean that the hero ignores that, and keep it as an aim. Alternatively, a friend&rsquo;s aim could be disallowed,
and the hero would try to achieve the aim for the friend, such as acquire an object and give it to the friend.</p>
<p>The next step then is to annotate the narrative functions with actions and aims; for example, <em>absentation</em>
could be an <em>atrans</em> of a friend to a location as an action, and the same for the hero as an aim, as the hero
wants to be with their friend. There might be some conflicting aim (such as staying at home, protecting the
family), but the resolution might be that the friend starts feeling sad when away from their home environment,
leading to the aim of coming back home, which then achieves the hero&rsquo;s aim as well.</p>
<p>I also need to start thinking about the <em>World Simulator</em>, the engine that does all the heavy lifting of
producing the story content. The original idea is to take <em>TaleSpin</em>, but that might be a bit too simplistic.
After all, it&rsquo;s only really been used for short stories about Joe Bear and Irving Bird. In addition I need
timestamping to keep track of where the various characters are and what they are doing, and a more sophisticated
logging facility, as the simulator log will be fed into the story renderer at the end. I also need to work
with multiple characters at once, so the whole setup needs to be a bit more capable than the original.</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 2</title><link>https://ojmason.net/nanogenmo-2/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-2/</guid><pubDate>Thu, 02 Nov 2017 23:08:09 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>Today was more of a research day, apart from some refactoring of yesterday&rsquo;s work. Spent ages trying to track down an error, which turned out to be one missing level of brackets in a data file. Oh well, at least I&rsquo;m getting used to debugging Scheme code now (I&rsquo;m using guile to develop this system).
To turn the basic plot into a story, I need to turn the Proppian functions into actions. So I&rsquo;m thinking of a way of annotating them with what essentially happens in each function. This can be a conceptual dependency-style structure, but possibly also using some higher level commands than just the basic primitives that Schank et al used in their work. These would later be expanded into such primitives to be fed into the language generator at the end.</description><content:encoded><![CDATA[<p>Today was more of a research day, apart from some refactoring of yesterday&rsquo;s work. Spent ages trying
to track down an error, which turned out to be one missing level of brackets in a data file. Oh well,
at least I&rsquo;m getting used to debugging Scheme code now (I&rsquo;m using guile to develop this system).</p>
<p>To turn the basic plot into a story, I need to turn the Proppian functions into actions. So I&rsquo;m thinking
of a way of annotating them with what essentially happens in each function. This can be a conceptual
dependency-style structure, but possibly also using some higher level commands than just the basic
primitives that Schank et al used in their work. These would later be expanded into such primitives to
be fed into the language generator at the end.</p>
<p>I&rsquo;ve also compiled an initial list of <em>aims</em>, which will drive what the characters will be doing. These
are for example</p>
<ul>
<li>go to location</li>
<li>go to person</li>
<li>acquire object</li>
<li>deliver object</li>
<li>acquire information</li>
<li>defeat person</li>
<li>destroy object</li>
</ul>
<p>So the Propp function <em>departure</em> maps onto giving the hero the aim <em>go to location</em>. What that location is,
remains to be seen. It could be the location where a person or object can be found. Whereas <em>reconnaissance</em>
gives the villain the aim <em>acquire information</em>. There will be different ways to achieve these aims, which
will involve sub-aims, and hopefully enough variation to generate plenty of different stories.</p>
<p>Thinking about characters, I&rsquo;ve been looking at emotions. Emotions will determine how characters react, though
I have as yet no clue how that would work. I&rsquo;ve come across a scheme by
<a href="https://en.wikipedia.org/wiki/Robert_Plutchik">Robert Plutchik</a>, which uses eight basic emotions, where two
are paired as counterparts:</p>
<ul>
<li>Trust - Disgust</li>
<li>Fear - Anger</li>
<li>Sadness - Joy</li>
<li>Surprise - Anticipation</li>
</ul>
<p>There would be a scale (-10 to +10 or so), so an emotion item would be a list of four numbers. A character
will have a basic emotional state, but would also have emotion items describing the relationship with other characters.
The states are variable, so if character A is angry, and meets character B, towards whome they feel joy, then they
might become less angry. Obviously a very simplistic way to model something as complicated as human emotions,
but the perfect is the enemy of the good. Especially if you only have one month!</p>
]]></content:encoded></item><item><title>National Novel Generation Month – Day 1</title><link>https://ojmason.net/nanogenmo-1/</link><guid isPermaLink="true">https://ojmason.net/nanogenmo-1/</guid><pubDate>Wed, 01 Nov 2017 22:29:36 +0000</pubDate><category>nlg</category><category>narrative</category><category>nanogenmo</category><description>I have this year finally managed to have a go at NaNoGenMo, the attempt to write code to generate a novel, in analogy to NaNoWriMo, where people try to actually write a novel themselves (which sounds like rather a lot of hard work). Instead, I will instruct the computer to do it for me.
My approach will consist of various stages, and at the top level I am planning to generate a broad and abstract sequence of events that will be fleshed out in subsequent stages. I have chosen the framework of Vladimir Propp, who analysed Russian folk tales and came up with a list of 31 narrative functions, which can be grouped into four distinct sections. I&rsquo;m generating a list of sections, where each section can have up to four functions, and then I pick the appropriate number of functions randomly from the list of functions for each section.</description><content:encoded><![CDATA[<p>I have this year finally managed to have a go at NaNoGenMo, the attempt to write code to generate a novel, in analogy
to NaNoWriMo, where people try to actually write a novel themselves (which sounds like rather a lot of hard
work). Instead, I will instruct the computer to do it for me.</p>
<p>My approach will consist of various stages, and at the top level I am planning to generate a broad and abstract
sequence of events that will be fleshed out in subsequent stages. I have chosen the framework of
<a href="https://en.wikipedia.org/wiki/Vladimir_Propp">Vladimir Propp</a>, who analysed Russian folk tales and came up with
a list of 31 <em>narrative functions</em>, which can be grouped into four distinct sections. I&rsquo;m generating a list of
sections, where each section can have up to four functions, and then I pick the appropriate number of functions
randomly from the list of functions for each section.</p>
<p>There are some constraints, so you cannot have a <em>return</em> unless you also had a <em>departure</em> beforehand. I have
implemented a very simple routine which churns out sequences that fulfil their constraints. Quite primitive at
the moment, but perhaps a starting point.</p>
<p>Some example outputs (for their meaning see the Wikipedia link above) are:</p>
<ul>
<li>
<p>(complicity trickery departure departure villany first-donor-func hero-reaction wedding pursuit)<br>
This is a bit weird, as there are two departures (but they could be different people), and after
the <em>wedding</em> there is a <em>pursuit</em>, so the hero is chased away by a villain after he got married
and rewarded/promoted. Strange, but perhaps leading to an interesting story!</p>
</li>
<li>
<p>(interdiction trickery interdiction trickery departure departure departure first-donor-func struggle struggle transfiguration difficult-task)<br>
Here the hero gets a warning/command twice, and each time a villain attempts some	deception. This time,
<em>three</em> people leave (I think that needs to be cut down to single occurrence only!) and a lot of fighting
is happening.</p>
</li>
</ul>
<p>Thing is, I can imagine writing a story around those functions. The
challenge is to see if the computer can do that, too. Still early
days.  The main concern with this whole thing is that the generated
novel will either be trivial and boring, or non-sensical and
incoherent. Probably even both. I am under no illusions that the final result will be worthwhile
reading; but I will only find out at the end!</p>
]]></content:encoded></item></channel></rss>