• No results found

Extracting rules from story synopses

N/A
N/A
Protected

Academic year: 2021

Share "Extracting rules from story synopses"

Copied!
34
0
0

Bezig met laden.... (Bekijk nu de volledige tekst)

Hele tekst

(1)

MSc Artificial Intelligence

Track: Learning Systems

Master Thesis

Extracting rules from story synopses

by

Sander Nugteren

6042023

December 15, 2016

42 EC

Supervisor:

Dr. F.M. Nack

Assessors:

Dr. R.G.F. Winkels

Dr. G. Ferri

(2)

Contents

1 Introduction 3 2 Related Work 5 2.1 Story . . . 5 2.2 Story representation . . . 5 2.3 Story generation . . . 5

3 Story and structure 8 4 Model 9 4.1 Overall pipeline . . . 9 4.2 Story representation . . . 11 4.2.1 States . . . 11 4.2.2 Actions . . . 13 4.3 Rules . . . 14 4.3.1 Rule representation . . . 14 4.3.2 Extracting rules . . . 15

4.3.3 Obtaining rule probabilities . . . 17

4.3.4 Using rule probabilities . . . 17

5 Evaluation 19 5.1 Dataset . . . 19

5.2 Extraction of a rule for transformation . . . 20

6 Discussion 23 7 Conclusion and future work 24 7.1 Future work . . . 24

A Action grammar 28 B Full stories 29 B.1 The Frog Prince . . . 29

(3)

Abstract

Storytelling is an important part of human culture. There has been much research on automated story-telling in the field of artificial intelligence. These approaches predominantly consisted of a story grammar (a set of rules which dictate what prerequisites a certain event has, and what the effect is on the story if the event happens) and a story generator, which uses these grammar rules to generate stories. The focus of the field has been on creating different story generators, while using human-made story grammars or human-made agents. This thesis is focused on extracting the grammar rules from existing stories instead of making them by hand. To facilitate this extraction process this thesis also aims to develop a representation of stories which enables learning their structure. This is done in such a way that these existing stories can be used to extract a story grammar which can be used to generate new stories in the future. When trained on two fairy tales (“The Frog Prince” and “Caliph Stork”) the program was able to capture the rules of the stories and was able to generalize over multiple occurrences of the same event type in different stories. This thesis marks a shift towards creating more sophisticated story representations and story grammar extraction, which is useful to generate more complex stories in combination with the multitude of story generators that already exist.

(4)

1

Introduction

Storytelling is an important part of human cultures around the world. This is evident from the important functions storytellers had in various societies throughout history, whether they are the skalds of Scandinavia and Iceland, the griots of West Africa or the minstrels of medieval Europe. Stories are used to preserve history and culture, and are used to transfer values and experiences across generations, encouraging a broadening of horizons through identifying with the characters in the story, and relating these experiences to the real world around the reader. The universalness of storytelling seems to imply that it is something fundamentaly human to do, which might tie it (like creativity) into the human thought process.

Storytelling is an expression of creativity, and therefore it is also important to first discuss creativity in general. Creativity is seen as being closely correlated with intelligence (either creativity being a component of intelligence, or the other way around). This makes creativity an important subject in the field of artificial intelligence.

There are many ways in which creativity can be expressed. In fact, any idea that is considered to be novel and to have some kind of value (e.g., monetary, aesthetic) is considered an expression of creativity. However, the term creativity is mostly used with regards to the arts, such as painting, sculpting, poetry and storytelling. In these artistic fields, creativity can be seen as a problem with two opposing objectives. On the one hand, the idea has to be novel, which means that it must be different enough from existing works. On the other hand, it should still be comprehensible with respect to the rules and conventions of the art. Generating a story filled with gibberish or a painting with random pixels is not a valuable contribution to the art, since it is hard to interpret a meaning. Of course, this is an extreme case, but one could also say that if a writer set out to create a new work in a particular genre (for example, a fairy tale), but ended up with something that is not recognized as a work belonging to that genre, they failed at their task to create a work in that genre (even though the work might have some unintentional value in some other way).

According to Boden ([2]) there are two types of creativity. There is psychological creativity (or p-creativity), where an idea is considered novel on a personal level, and there is historical creativity (h-creativity), where the idea has to be novel on a historical level (i.e., have other people in history come up with the same idea?). In computational creativity, usually a form of p-creativity is considered, since to have an h-creative system would require to put in all history of that subject. This does not mean that algorithms can not produce h-creative work, it is just harder to check if the work is h-creative.

Most other works in the field of automated story generation (for example [5, 12, 21, 24, 26], these works will be explored more in-depth in section 2) focus on creating a rule system by hand (in the form of story grammar rules or rules that story agents should follow). This is not ideal, since the creator of these rules could easily add in personal bias (even subconsciously), forget to add certain knowledge (especially common sense knowledge), and the rules can not evolve further without human interference, therefore limiting the amount of stories that can be generated.

A different approach might be that of instance-based learning, where the story grammar rules are learned from the stories in a story database instead of the rules being made by hand. By analyzing all events that happened in the stories, it would also be possible to obtain probabilities for certain events to happen. This rule extraction paradigm has the advantage that new rules can be learned from new stories automatically, and that the probability of an event (the measure of creativity of an event) is dependent on which stories have already been analyzed, which is a good metric if one considers p-creativity. Furthermore, the more data will be added, the more the rule distribution of the model will start to match the actual historical use of rules and tropes, which would bring the system closer to h-creativity.

From another perspective, this is analogous to how the human creative writing process works. Authors read a lot of stories or have real-life experiences and recombine elements from these in their own stories in novel and interesting ways. This is analogous to expanding the author’s own knowledge of story conventions (and since their personal knowledge of historical uses of tropes increases, the chance that a certain p-creative piece of writing is also h-creative also increases). This knowledge of story elements could be used directly, using story elements as they appeared, but these story elements could also be inverted (for example, using a story element that is usually associated with a hero for a villain, or using a story element that is associated with female characters for a male character or vice versa) or subverted (the author makes the reader think something will happen by tricking the reader into thinking that a certain story element is happening, but then something else happens).

The ruleset extracted in this way could be used both in a fully automated story generator, where an algorithm uses the rules and their associated probabilities to generate a story with minimal human input or even none at all, or it could be used as a component of a recommender system for writers (like the co-creative approaches detailed in [15]), where it receives the story the author wrote and makes suggestions to help further plot development, or augment the story to make it more interesting for the author’s intended audience. It could also be used to compare different stories and analyze where similarities can be found. This would lead to automated story analysis, which could help writers in a more indirect way (by learning more about the structure of other stories,

(5)

a writer can improve their understanding of a particular genre or storytelling in general).

The research question of this thesis is, therefore: “How can a representation of stories and story rules be designed, in such a way that it is both well-suited to extracting story rules from stories and well-suited to generate stories from these rules?”.

The rest of this thesis will be structured as follows: in section 2, related work (mainly in the field of storytelling) will be discussed, and an analysis will be done on what story representations these approaches used. In section 3, the theoretical hierarchy of story elements will be described, which forms the basis for the elements modelled in the story representation described in this thesis. Then in section 4, a proposal for a story generation pipeline will be discussed, as well as the story representation and rule extraction done in this thesis, and how this fits in this more general pipeline. In section 5, an example of a rule being extracted from two occurences in two fairy tales (“The Frog Prince” and “Caliph Stork”) will be discussed. In section 6 the properties of the model will be discussed, in section 7 some conclusions will be drawn about performance of the representation and some proposals for future work will be discussed.

(6)

2

Related Work

Much research has been done on computational creativity, for example in videogames [9, 18], painting [8], dance choreography [3] and music [14].

In this section related work on storytelling will be discussed. First the different approaches to story analysis will be covered, followed by a discussion of story representation. Afterwards some different formalisms for story generation will be discussed.

2.1

Story

To develop a representation for stories it is necessary to know what the components of a story are and how to represent them. Because of that it is useful to look at literary theory to see which concepts are important to represent when representing a story. Throughout history there have been many movements of literary theory, such as the Marxist theory of literary criticism, which views stories in terms of the society from which they originate [10], Darwinian literary criticism which views stories in the context of evolutionary biology [4] and many others. From the 1910s to the 1930s the Russian formalist movement was a popular school of literary theory [11]. It was a structuralist movement, which means that the movement’s members tried to analyze literature by analyzing only the story structure (the story devices that were used) that was objectively present in the story instead of the previously mentioned traditional psychological or culture-historical approaches, which tended to result in more subjective story analyses. Because of the emphasis on story structure this school of literary theory is the most attractive starting point for automated story telling, since the structures are already catalogued in such a way that a grammar or similar rule system can be based on them. This framework formed the basis for many early automated story generators, which will be discussed in section 2.3. Chatman [7] defines a hierarchy of narrative elements such as characters, actions and setting, which together form the whole narrative experience. Chatman’s hierarchy is structuralist in nature like the work of the Russian formalists, since it also describes stories in terms of their structure. Chatman’s hierarchy will be explored further in section 3, since it forms the theoretical framework of the representation developed in this thesis.

2.2

Story representation

In 1975, Minsky, a pioneer of artificial intelligence, devised a representation of events called frames [22]. These frames represented a stereotyped scenario (such as going to a child’s birthday party) as a list of actions that described the scenario, with certain concepts being constants (always true for that type of situation) and others being variables that could be instantiated for each situation. Related frames (representing sequences of scenarios) are linked together in frame systems. This representation was not devised specifically for storytelling purposes, but rather to capture general world knowledge, from natural language to computer vision, in such a way that these diverse types of knowledge could be compared. Because the representation was designed for such a general purpose, the representation is described in very general terms, and therefore difficult to apply in practice.

A similar but more practical version of this idea was proposed by Schank and Abelson [29]. They tried to capture similar sequences of events in scripts. This representation was similar to the frame representation, but was more structured, since all actions that were possible to execute within a script were defined. Since the aim was to represent knowledge and not storytelling, it did not implement measures to ensure creativity, but was geared more towards question answering about the story content.

A continuation of this work on knowledge representation can be seen in case-based reasoning. Case-based reasoning is based on the idea that new problems can be solved by using the solutions to past problems. This is done by adapting the solution of an old problem to fit a new problem. This idea was pioneered by Schank [28]. To aid the creation of the semantic web (a machine-readable internet), another form of knowledge repre-sentation was developed, the Resource Description Framework (RDF) [16]. This reprerepre-sentation specification was designed to represent the relations between different entities (which were represented by uniform resource identifier (URI)). These relations were represented as so-called triples, in the form of subject-predicate-object. The ontologies created with RDF can be seen as graphs, with URI’s being the nodes and predicates being the relations between these nodes.

2.3

Story generation

Most early work in automated storytelling has been inspired by the work of Propp [25], who was a Russian formalist. Propp identified many recurring plot elements in Russian folk tales (for example ‘pursuit’, where the hero pursues the villain, or ‘wedding’, where the hero marries and gets rewarded by the community (for example by ascension to the throne)), as well as recurring character archetypes (hero, villain, the helper and the princess).

(7)

The work of Propp served to create an ontology for folk tales, so that they could be more easily analyzed and compared, but later inspired approaches using a story grammar, the intuition being that there exists a distinct ordering of story elements for all stories within a certain genre (with variations being possible in story elements and some story elements being optional). A notable example of this story grammar philosophy is TALE-SPIN [21], which tries to model the author process as generating a problem for the story by selecting certain attributes for characters (for example, one of the characters is hungry), and then applies certain grammar rules to solve the problem of the story (the character tries to obtain food). Propp’s notion of recurring character archetypes is also still popular, even outside of story grammar approaches and outside of the domain of Russian folk tales (for example, the work of Mosher and Magerko [23] incorporates stereotypes in an agent-based approach rather than a story grammar-based approach). Of course, all story rules and all possible character attributes for the grammar were put in a priori, and therefore the stories that could be generated were very basic. Also, story generation is seen as purely logic problem solving, and therefore there is no way to distinguish between all possible problem solutions in such a way that the most enjoyable solution (for the reader) is chosen.

More recently, there is the work by Gerv´as et al. [12] that uses case-based reasoning with a representation based on the plot elements and character archetypes of Propp. The way the approach by Gerv´as works is that a sequence of events is generated using the building blocks provided by Propp, and then templates are used to generate a story in natural language. The model proposed in this thesis is more general, however, since there is very little domain knowledge involved (just the content of the stories themselves, as opposed to the manually obtained knowledge from Propp). This makes this model more generally applicable outside of the folk tale domain, not just for generating new stories within other genres by simply training on a different set of stories, but possibly also to build a story model using multiple genres at the same time.

McIntyre and Lapata [20] describe a system which generates stories using evolutionary algorithms. This work is inspired by the work of Chambers and Jurafsky [6]. Both works are also data-driven, but they try to learn certain predicate co-occurences (when someone gets arrested, he is usually interrogated next) and entity-predicate co-occurences (the person performing the arrest is a member of the set {detective, police officer}). The schemata learned in this way are learned for events involving a certain participant (called the protagonist ). This leads to schemata that can contain a great deal of events. This schemata can be branching (somebody on trial might be convicted or go free), further increasing the complexity of the structures learned. Though generating stories using these long event chains would improve story coherence, it might impede the creativity of the story generator, since trying something novel is difficult to do with these rigid structures. Not only are the structures very large, making them difficult to recombine, but they are also centered on the protagonist, so substituting the protagonist with another character when creating a new story becomes difficult. In contrast, the structures presented in this work are much simpler and therefore more easily recombined in novel ways.

The storygenerator MAKEBELIEVE by Liu and Singh [19] uses a database of common sense reasoning to generate its stories. It would start out with some initial premise, and then use common sense to infer the logical consequences. However, this common sense database was not specifically constructed to generate stories, so the stories that were generated tended to be very logical, but therefore also very predictable. By learning from the stories directly, we know that the events have appeared at least once in a story, and therefore can be used to make a compelling story. In addition to this, these common sense databases were generally created to solve real-world problems. However, in many story genres the rules of what is possible in the world are very different. In fairy tales, there is magic which can do things that are not normally possible, while in science fiction advanced technology fulfills a similar function. Because of this, these common sense databases are ill-suited to generate these kinds of stories, which brings back the problem that somehow knowledge again has to be obtained about the fantasy world. If the representation of that knowledge is still in ontologies, these ontologies would have to be created for each genre or even each individual story (the rules from science fiction can be different from fairy tales, and even between two separate science fiction universes there can be a difference in what is and what is not possible).

Another paradigm, separate from the story grammar tradition started by Propp, that has gained popularity in the field of automated story generation is an agent-based approach. In this approach, all characters are logical agents interacting with each other in an attempt to fulfill their personal goals. In some cases there is also a director-like agent outside of the story world, that ensures that the story that is being generated adheres to certain constraints to make the story enjoyable, instead of just a long series of interactions between agents.

In a videogame or a training simulation, where the user interacts with different entities all the time, this is a very natural way of thinking about story generation. For example, IN-TALE by Riedl and Stern [26] was used to simulate the experience of being an army officer of a peacekeeping force on a busy marketplace in a 3D computer game engine. In this simulation, each character is an agent with its own goals, trying to achieve them within the simulation while interacting with the human character. Another example of this agent-based paradigm is the interactive story system of Cavazza, Charles and Mead [5], where the user is watching a narrative in a simulated environment and is able to influence the narrative by their own actions. However, both these systems have in common that they work off a certain scenario, constricting the possible actions of both the user and the actors.

(8)

Because of this, these systems are not able to generate a large variety of different stories, but just variations within the same scenario.

The work in this paper is mainly inspired by the MEXICA story generator [24]. This was a system that generated stories with a human-made grammar. The story was represented as a sequence of states and actions. The states were represented as a graph of the characters in the story, with a numerical relation representing the relation between the character, ranging from hate to love. The architecture used in this thesis is similar, in that it also represents the story as a sequence of states and actions, and that each state consists of a graph of all actors in the story. Both state representations are also similar to the RDF format, since all relations are also defined as triples (subject-predicate-object). However, in MEXICA the relations between characters were much simpler (the only type of relation between characters is a 5 point scale ranging from hatred to love), and all possible actions had to be pre-defined (they were not learned from other stories, like in this thesis). In this work, the focus is more on the rule-extraction side, whereas MEXICA was more focused on the generation of the stories. The method described in this paper could be used to suplement MEXICA with a way to learn actions from stories themselves, while leaving the actual generation to MEXICA itself, though.

(9)

Narrative Story (content) Events Actions Happenings Existents Characters Setting

Setting rules Setting objects

Discourse (expression)

Figure 1: Hierarchical model of narrative structure. Adapted from Chatman [7]

3

Story and structure

As mentioned in section 2.1, a theoretical model of narratives and their components is needed first to properly represent stories. The narrative model adapted for use as a basis for this thesis can be seen in figure 1, and in this section the different components of the model will be explained. According to Chatman [7], a narrative has the following parts: the story (content) and the discourse (expression). The story describes the events happening in the story and the world that the story takes place in, while the discourse covers how the content is communicated by the medium (including stylistical figures in writing, use of the camera and lighting in movies, etc.). This thesis mainly aims to model the story, though of course the story rules that are extracted are obtained from the story synopses in text form, so the medium, in our case text, does have some influence on the extraction process (and since the medium is part of the discourse, the extraction process is influenced by the discourse).

Story events have characters that are involved with them. These events can either be happenings that occur without the characters intentionally trying to make them happen (for example, the start of a storm or an earthquake), or actions that happen because the characters make them happen (for example, a character tries to obtain something, or a character tries to persuade someone to do something).

Another part of the story is the set of existents, which covers everything that exists in the story. This includes the characters of the story and the setting. In Chatman’s model, the setting includes everything besides the characters, but for designing a story representation it is more useful to distinguish between the setting rules (the laws of physics, technology, magic, law, etc. in this particular setting, but also genre conventions that are usually present more implicitly in the story) and the setting objects (all objects in the story that are not characters). This is useful since it is possible to write many stories with different characters and setting objects in the same setting, which is done by re-using the setting rules of another story. In a broader context, it would allow comparison between the setting rules from different stories, allowing them to be clustered according to how similar their settings are, which could be used to predict if stories are in similar genres.

In the original model the substance of content was also defined, meaning the story content filtered through the author’s personal biases, which includes cultural and personal biases. This of course influences the existents and events, but since it is something that is not explicit in the story it is difficult to extract in an objective manner (compared to for example the story events). It is, however, implicitly present in the setting rules, and so influences all narrative elements indirectly. Because of its subjectiveness in an otherwise structuralist approach, it is therefore not modeled in the representation presented in this thesis.

This section outlined a theoretical model of narrative elements. In section 4 the practical implementation of these elements will be outlined.

(10)

4

Model

To reiterate section 2, most preceding models suffer from one or more of the following problems:

• A rigidness that impedes variation and therefore creativity (an example of this can be found in the work of Chambers and Jurafsky, which learns very long and intricate schemata for its protagonist, making it gain coherence but losing flexibility).

• The starting scenario is the same every time (for example, in IN-TALE, there are very few possibilities for the story outcome, because the characters are the same for each story, and the ending is only dependent on the person playing the simulation).

• The story rules are made by hand (Gerv´as uses the story elements annotated by Propp, while in MEXICA the rules have been made by the creator of the program) or are lifted from knowledge bases not specifically designed for story generation (MAKEBELIEVE by Liu and Singh).

This section introduces the general problem of how to generate stories using existing stories as a basis. Since this problem is too complex to solve at once, it has to be divided into different sub-problems. The work described in this paper aims to solve some of these problems (namely, learn story rules from a set of annotated stories), but in section 4.1 some possible solutions for the unsolved sub-problems are also given. The focus on rule extraction and representation has been chosen since, as can be seen in the related work section, the research focus has been mostly on story generation rather than rule production.

4.1

Overall pipeline

Generating complete stories from a database of raw unannotated stories is a complicated process, which has to be partitioned into multiple components. The components of the general pipeline which is proposed for this work is as follows (see also figure 2 for how these components are connected to each other):

1. A story database: This would be the set of as many stories as possible in a certain genre (for example, fairy tales), or possibly even multiple genres, if the objective is to generate stories that are a hybrid between genres. For now these stories are assumed to be text, but in the future this could possibly involve other types of media (film, video games, etc.) as well. The stories in this database would be stored using the story name as an identifier, and the full text as the value.

2. A story synopsis database: Learning rules directly from the full story text is difficult, since the story events are spread out across a long text, making them hard to identify. Therefore it would be beneficial if the stories in the story database were summarized in some way. One option is to generate these synopses automatically from the full stories, using the work of, for example, Salton, Singhal, Mitra and Buckley [27]. Another option is to use human-made summaries, which exist for many stories already (from Wikipedia or other internet sources, for example). In both cases the quality of the synopses could be improved by incorporating human judges who select the most accurate synopses (and since this process is subjective, it would be best to have multiple judges to rate the synopses).

By extracting the story synopsis the story is reduced to just the major plot elements, which should make rule extraction easier (the story will be reduced to its bare essence, so there will be less long-term dependencies of story events). The story synopses would be stored in a similar way, using the story name as an identifier again, and using the synopsis in text form as a key.

3. A database of logically represented stories: There has to be some way to transform the plot synopses into a logical representation, so that a computer can reason about story events. When this structure is available, stories can be more easily compared, and rules can be extracted from them. The way the stories are represented is outlined in section 4.2.

4. A database of story rules: This database contains the rules of how story events should unfold (the effect on the story), and when these events are possible (the event prerequisites). It also stores which characters were involved with an action and in what way (either as the subject, object, or dative). The way these rules are represented is outlined in section 4.3.

5. Generation of logically represented stories: Using the rules that have been stored in the story rule database, a new story can be generated, either from a some premise (a random initial state is chosen, or a co-author supplies some desired initial or intermediate state), or by adapting an existing story (taking parts of one of the observed stories and substituting them for others).

(11)

Rules level

Database of story rules

Logic level Database of logically repre-sented stories Generation of logically repre-sented stories Synopsis level

Story synopsis database Generation of story synopses

Story level

Story database Generation of full stories

Figure 2: The story generation pipeline

6. Generation of story synopses: Since there is a reference from the logically represented rule to the synopsis text, it could be used to generate a story synopsis. This could be useful if the system is used as an assistant to a human author, since the format is easier to read and interpret, but still condensed enough to gauge how interesting the plot is. This is essentially what most automated story generators such as MEXICA and TALE-SPIN produce, since these texts often do not contain dialogue or prose that does not directly further the plot.

7. Generation of full stories: To make the stories enjoyable, the plot synopses have to be transformed into full stories. For text this means expanding the synopsis into a story with enjoyable prose, dialogue. For other media, such as film or videogames, creating sounds or graphics might be required too.

These components are visualized in a hierarchy in figure 2. In this figure, four conceptual levels have been defined:

• The story level at the base, where the stories are in their full prose form.

• The synopsis level, where the stories are in the form of a human-readable synopsis.

• The logic level, where the stories are represented as a sequence of states and actions, and where the rules are extracted from them.

• The rules level, where the complete rule set is stored that has been extracted from the stories the program has seen.

The focus of this thesis is twofold: the main contribution is a way to extract the story rules from a set of logically represented stories, and represent them in such a way that a program can be designed that can reason about these rules in a creative way. This corresponds to the logic database component at the top of figure 2, which details the assumed pipeline. To do this, the story synopses have been annotated manually to be able to focus on this part. However, the story representation has been chosen in such a way that it could plausibly be extracted in that form through natural language processing. This story annotation scheme is another contribution of this thesis. Its simplicity makes it easy to annotate (and later, to extract the story

(12)

structure automatically), easy to visualize (which is important if this system is going to be used as a co-creator with a human author) and easy to reason about (it is easy to find the difference between different story states, which is helpful to reason about the effect of an action).

The overall approach of the work described in this thesis is as follows: the stories are assumed to be annotated as a sequence of story states (represented as graphs of characters, their goals and desires, and how these interact with each other) and actions (simple sentences in natural language describing story events). First, the action sentences are parsed to find the object, subject, verb and dative (where applicable). Then, the preconditions of the actions (what has to be true before this event can occur in such a way that it makes sense?) and the effects of the action (what happens when this event takes place in the story? How are the characters affected by the action?) are extracted, by looking at the states prior and following the event. This information is then stored in a database, which can be queried to obtain the likelihood of particular events.

4.2

Story representation

Before the rule extraction process will be covered, the story representation will be discussed, since this influenced the representation of the rules. A basic story is represented by a series of states si and actions aj. Each story

starts in some initial state s0, then one or more actions happen (a0, ..., aj). These actions involve at least one,

but possibly multiple characters in the story, and transform the story state s0 into s1. This is followed by one

or more actions again, which leads to s2, and so on. This pattern continues until the final state of the story

is reached, which is when the story ends. This model is inspired by the MEXICA model, although it is less constrained, since a state can be followed by multiple actions instead of just one.

The story sequence is assumed to be represented temporally (si+1 occurs after si). To represent events

happening in parallel, stories can contain stories themselves too. For example, in a story, character A meets character B at some place, and character B will tell character A about the events that led character B to be at this particular place. To see why this is important, it is useful to introduce two technical terms from formalism: the fabula (the chronological order of events as they happened in the story world) and the syuzhet (the order of events as presented in the plot to the reader/viewer). When stories are told in chronological order, the ordering of the fabula and the syuzhet is the same. But when the story includes flashbacks or flashforwards, there is a difference in ordering for the fabula and syuzhet (an extreme case of differences between fabula and syuzhet is the movie ‘Memento’, where the first scene of the movie is the one that happens last in the fabula of the story and most of the rest of the story is told backwards from there). The use of flashbacks and flashforwards is usually done for dramatic effect (revealing information to the reader at the appropriate time), so, for story analysis, it is important that this distinction can be made, in the form of a story-within-a-story. Another set of examples of stories where this construction would be useful would be the stories of ‘One Thousand and One Nights’ or ‘Canterbury Tales’, which are framing stories containing stories themselves. For the current algorithm, this construction does not affect the rule extraction (the stories are read as separate stories), but for future deeper analysis this construction could be useful. If story structure will also be learned from existing stories, this might be helpful to a program that has to be able to generate flashbacks or framing stories, since it enables stories to serve as examples of self-contained narratives (meaning that the story-within-a-story has to be finished before the main story resumes).

4.2.1 States

States are represented as a graph filled with nodes. These nodes represent currently active characters, their abilities and their needs. The relations in the graph define a connection between these entities. The state represents the existents in the story, as defined by the Chatman model presented in the section 3, since it contains the characters and objects (which could be seen as part of the setting) that are active in the story at the time. This representation has been influenced by MEXICA, but is also similar to RDF in structure, since the entities are also connected together in triples (subject-predicate-object).

An example of two states can be seen in figure 3. In this figure we see the princess and frog characters represented as nodes, their abilities and desires being nodes themselves that are connected to their respective characters. These characters are identified by their by name, and therefore the rules will also learn rules that are dependent on these names (for example, the princess character is more likely to perform some action than another). This works since the system was tested on fairy tales, where the characters are mostly referred to by their archetype (‘the princess does this’, ‘the frog does that’), rather than an actual name. However, as mentioned in section 2, the notion of character archetypes is useful even outside of the fairy tale genre, and therefore it is still useful to learn the behavior of archetypes.

Agreements such as promises are also represented as nodes, connecting abilities and desires with each other. For example, ‘promise:2’ in State 1 represents the frog’s promise to get the ball for the princess. This is because the node is connected to the node frog abilities:get(ball) (representing the frog’s ability to retrieve the ball) and the node princess needs:retrieve(ball) (representing the princess wanting to have the ball).

(13)

princess princess abilities:companionship princess needs:retrieve(ball) princess race:human promise:1 promise:2 frog abilities:get(ball) frog needs:companionship frog frog race:animal State 1

the frog gets the ball

princess princess abilities:companionship princess race:human promise:1 frog abilities:get(ball) frog needs:companionship frog frog race:animal State 2

Figure 3: Representation of a simple state-action-state transition. State 1 represents the part of “The Frog Prince” where the frog had promised to get the princess’s golden ball from the bottom of a pond, in return for spending time with him (these promises are represented as relations between the relevant abilities and needs of the princess and the frog). There is one action, where the frog gets the ball for the princess, which leads to the altered state in State 2 (The princess does not need the ball anymore, and the promise has been fulfilled, which is why both nodes have been removed from the graph).

(14)

S[subj=“frog”, verb=“gets”, obj=“ball”, dat=“”] NP[N=“frog”] Det[Det=“the”] the N[N=“frog”] frog

VP[V=“gets”, N=“ball”, dat=“”]

V[V=“gets”] gets NP[N=“ball”] Det[Det=“the”] the N[N=“ball”] ball

Figure 4: An example of an action being parsed from a sentence

4.2.2 Actions

Actions are represented as a short, natural language-like phrase (for example ‘‘the frog gets the ball" or ‘‘the frog promises the ball to the princess"). The action in this model actually represents the event as defined in section 3, which can be either an action (a deliberate action executed by a character) or a happening (events that happen without being done intentionally by a character) The actions were not annotated in the form of logic, since being able to parse actions in natural language would be a step closer to the goal of both extracting patterns directly from story synopses written in natural language and generating the synopsis of a story in natural language from a logical representation. In other words, these sentences are closer to the sentences which might be found in the story synopsis database (component 2 of the pipeline outlined in section 4.1).

These sentences are parsed with the Python Natural Language Toolkit (NLTK) [1] to obtain the subject, verb and optionally the object and/or dative (which will be referred to as subj, verb, obj and dat, respectively). For example ”the frog gets the ball” would yield obj = “ball”, subj = “frog”, verb = “gets”, dat = “”. First the sentences are tokenized (individual words are separated, comma’s are separated from the word they are attached to, etc.). Then NLTK assigns a Part of Speech (P.O.S.) tag, denoting the lexical category that the word belongs to. This takes care of most of the ambiguity found on the lexical level by looking at the context in which the word appears (in the second example, “promises” could be a noun or a verb, but due to the context it is tagged as a verb). For the experiments the P.O.S.-tagger recommended by the NLTK was used, which is a perceptron tagger trained on the Penn Treebank dataset.

Then, the sentence is parsed using a simple tree-parser which uses a feature-based grammar. This grammar contains rules to infer which word is the subject, which word is the object, and so on. The rules in the grammar have the following form:

S[subj = s, verb = v, obj = o, dat = d] ⇒ NP[N = s]VP[V = v, N = o, dat = d]

On the left hand side there is one non-terminal (in this case S), and on the right hand side there is at least one terminal or non-terminal symbol (NP and VP). The values for the variables are obtained in a recursive fashion. This means that the instantiation of s, v and o in the previous rule are dependent on the rules chosen to expand the NP and VP nodes of the tree. After enough node expansions a non-terminal will be expanded to a terminal, which will instantiate the variables. This way we obtain values for subj, obj, verb and dat. It is imporant to note again that not all of these fields need to be instantiated. Most sentences don’t have a dative, and with intransitive verbs there is no object either (for example, the sentence ‘John walks.’ only has a subject (‘John’) and a verb (‘walks’)). The grammar that was used to parse the actions can be found in appendix A.

An example of what happens if the sentence “the frog gets the ball” is parsed can be seen in figure 4. By applying the grammar rules, the tree parser eventually finds the object, subject, verb and dative of the sentence and store these variables, if they have been instantiated. The extracted action looks as follows:

[ OBJ = ‘ball’ ] [ SUB = ‘frog’ ] [ VERB = ‘gets’ ]

(15)

4.3

Rules

When the actions have been extracted, the corresponding rules have to be extracted. This way multiple occurences of the same event can be compared, thus revealing both similarities and differences of the same event type. This means extracting the precondition (prec) and the effect (eff) by looking at the state before the action happened and the state after the action happened. These two concepts together represent the setting rules as defined in section 3 and will be further explained in section 4.3.1. The source of the rule is also stored in the source variable. This section will discuss the representation of the rules, the extraction process and how the resulting rules are queried.

4.3.1 Rule representation

Rule objects are similar in form to action objects. These are extracted from the stories by seeing how states are affected by a certain action. They are represented as a tuple of (action, obj, subj, dat, source, prec, eff). These concepts are defined as follows:

• Here, the verb denoting which action is taking place is stored in action. This is obtained from the parsed sentences’s verb field. For example, “promises” is the action obtained from the sentence ‘‘the frog promises the ball to the princess’’, since “promises” is the verb of the sentence.

• The representation also stores which agents acted as objects, subjects, and datives in obj, subj and dat, respectively. This is because the representation was developed for fairy tales, which often contain certain stock characters (the king, the princess, the witch, etc.). These characters often fullfill the same kind of role across fairy tales (the prince marries the princess in many stories, for example). That way, the program could for example learn that the princess character rarely murders anyone (the princess acting as the subject of the ‘murder’ action has a low probability), but is more likely to marry someone (the princess acting as the subject of the ‘marry’ action has a high probability) or be married by someone (the princess acting as the object of the ‘marry’ action has a high probability). How these probabilities are computed will be covered in section 4.3.3.

• source stores the name of the story from which the rule was extracted. This could be used in a future generation system to look up what story the rule is from, which could link this to the relevant text in the synopsis and the relevant text in the full story. This could then be used in the generation program to learn how to generate synopses from the logical representation, and to generate full stories from the synopses.

• prec represents the preconditions of the action in terms of what relations certain actors should have with each other (in other words, what has to be true in the current story state before this action becomes possible?). This is represented as a reduced subset of the action directly prior to the action, only involving the characters involved in the action, their properties and the relations between each character.

• eff represents the effects of the action (what happens if this action is taken?). This is expressed in terms of either nodes in the state graph appearing or dissappearing (these nodes can be characters, their desires and abilities) or connections between nodes (representing the connections between these entities) appearing or dissappearing.

For example, if a = "kill", prec might be {hates(subj, obj)} (a character has to hate someone before they kill them), and eff would be delete(obj) (if a character is killed, they are removed from the next state). Note that both prec and eff are sets of conditions. An action can have multiple prerequisites and multiple effects on the story state.

An example of one of the extracted rules is the following:

OBJ = ‘ball’ SUB = ‘frog’ PREC = [ (‘SUB’, ‘SUB_abilities:get(OBJ)’), (‘SUB_needs:companionship’, ‘promise:2’), (‘SUB_needs:companionship’, ‘SUB’), (‘SUB’, ‘SUB_race:animal’), (‘SUB_abilities:get(OBJ)’, ‘promise:1’), (‘SUB_abilities:get(OBJ)’, ‘SUB’), (‘SUB’, ‘SUB_needs:companionship’), (‘SUB_race:animal’, ‘SUB’)

(16)

] EFF = { ‘edges_gone’: [ (‘promise:1’, ‘SUB_abilities:get(OBJ)’) ] } SOURCE = ‘frogprince’

This is the rule that has been derived from the action that was presented in figure 3. The meaning and derivation of this rule will be further discussed in section 4.3.2.

4.3.2 Extracting rules

Extracting the effect eff of an action is the easiest. For now actions are not assumed to have effects that do not become apparent immediately (in other words, the action has an immediate effect on the next state, but no lingering effects on the states after that). Therefore it is enough to see what the difference is between the state before and the state after the action. The different concepts that are tracked are the nodes in the graph that appear and disappear in the new state, and the connections that appear and dissappear in the new state. However, because multiple actions can appear between states it is difficult to discern which actions affects what parts of the network. For example, in figure 5 a simplified example of a state transition is given where there are multiple actions between states. In this example, there are multiple changes in the state:

• The caliph race:human node disappears. • The vizier race:human node disappears. • The caliph race:animal node appears. • The vizier race:animal node appears.

• A connection appears between the caliph node and the caliph race:animal node. • A connection appears between the vizier node and the vizier race:animal node.

When trying to see which action had which effect, the program could infer that the action “the caliph transforms into an animal” influenced the appearance of the vizier race:animal node, but this is unlikely, since the vizier was not even involved in that action

Therefore, for each action, the algorithm only looks at the actors involved in the action (obj, subj, dat), and the nodes connected to them directly (these nodes are assumed to be either desires or abilities of the characters). This keeps the preconditions managable too, since they don’t just include the whole state difference, but only the relevant parts for the action. In the example of figure 5 this means that the appearance of the caliph race:animal node will be correctly determined to be the effect of the action “the caliph transforms into an animal”, since the nodes that are not connected to the caliph node will not be considered. Of course this assumption breaks down if a lot of actions between two states involve the same actor (in the example of figure 5, if the caliph character had been involved in multiple actions and multiple things related to the caliph character changed, it would not be unambiguously clear what action had what effect), but this pruning of possible actors does already reduce the ambiguity in a meaningful way.

At first the program only looked at the characters themselves, but since the interesting relations were mostly between the desires and abilities of the characters, and not the characters themselves (for example, in figure 3 there is no direct relation between the princess and frog nodes, but their abilities and desires are linked to promises), this did not pick up the more interesting preconditions and effects of each action.

Consequently, in figure 3 the frog node and the nodes containing the word ”ball” (”frog abilities:ball” and ”princess needs:ball”) are considered by the program, as well as their immediate neighbor nodes and the connections to them (in effect, the whole first state excluding the princess node).

Similar to effects, for the preconditions prec the state immediately prior to the action is assumed to have all the necessary information for the action in it (it is not necessary to look at the preceding states, since they offer no additional information). Therefore all information in the previous state is assumed to be a part of the precondition. This is analogous to the Markov property found in Markov chains, where the previous state also contains all necessary information to predict the next action that has to be taken. However, this is reduced like the preconditions to only the actors involved in the action, and the nodes directly connected to them.

Another context unit that is also stored is in which story a particular occurence of a rule was found. This can later be helpful if the program is used as a tool for story analysis (since one can easily see where a rule comes from, and which stories have similar rule structures), but could also be used to guide the creation process of a generation algorithm, by introducing a bias for certain stories if so desired. This bias would be helpful if

(17)

caliph

caliph race:human

vizier

vizier race:human

State 1

the caliph transforms into an animal

the vizier transforms into an animal

caliph

caliph race:animal

vizier

vizier race:animal

State 2

Figure 5: State transition with multiple actions between the states. The sequence was taken from one of the stories in Caliph Stork and simplified, in order to better explain the ambiguity that is created by having multiple actions between states, and how this ambiguity can be reduced.

the program would be allowed to train on stories it generated itself, giving preference to human-created stories, since they are known to be well-constructed.

Before storing the preconditions and effects, all occurences of the characters in these rules are substituted for variables. This is done so that rules can be more easily compared, since for rule analysis the function a character has in the event is more important than the character archetype. Without this step an extra lookup of the character’s function in a rule could be done whenever the rule is queried, but it is easier to only do this once. To extract the effects and preconditions, the program looks at which characters are involved in what function (obj, subj, dat) and substituting them for a variable denoting this function. In the example, the subject subj equals ‘frog’, so all occurences in the preconditions and effects of the term ‘frog’ are substituted for the variable ‘SUB’. Given the action parse of the previous section and the states present in figure 3, the following rule is extracted. OBJ = ‘ball’ SUB = ‘frog’ PREC = [ (‘SUB’, ‘SUB_abilities:get(OBJ)’), (‘SUB_needs:companionship’, ‘promise:2’), (‘SUB_needs:companionship’, ‘SUB’), (‘SUB’, ‘SUB_race:animal’), (‘SUB_abilities:get(OBJ)’, ‘promise:1’), (‘SUB_abilities:get(OBJ)’, ‘SUB’), (‘SUB’, ‘SUB_needs:companionship’), (‘SUB_race:animal’, ‘SUB’) ] EFF = { ‘edges_gone’: [ (‘promise:1’, ‘SUB_abilities:get(OBJ)’) ] } SOURCE = ‘frogprince’

(18)

4.3.3 Obtaining rule probabilities

All extracted actions are stored together in a database (in the current implementation this is a Python dictionary, with the actions as keys and the rest of the information stored in an object as a value). This database can be queried for the probabilities of certain actions:

p(a) = PCount (a)

x∈ACount (x )

Here a is the action and A is the set of all seen actions. This database can also be queried in a conditional manner (for example, if a generation program needs to find some action for the princess to perform in the story, we can simply query the probability of different actions, given that the princess is the subject of the action:

p(a | asubj = ‘‘princess’’) = Count (asubj = ‘‘princess’’)Count (a)

In the current implementation, no probabilities are pre-calculated, but if this system would be trained on a large amount of stories it would be better to at least store the counts for all actions in a table to speed up the calculation of the probabilities.

The rule probabilities can be used by a planning algorithm to generate stories in a creative manner. In the introduction of this thesis, it was noted that to ensure that the story generation yields creative stories, stories have to be generated that are both novel but are also comprehensible. With the action probabilities, we have a metric of how plausible certain actions are, so a planning algorithm could choose the next action based on how plausible the story is. If the story is following the existing stories too much (the probability of the generated story becomes too high), it can choose an action with a low probability in an attempt to make the story more creative. But if the story becomes too unpredictable (the probability of the story becomes too low), the program might choose an action with a high probability to try to balance things out. However, finding which exact values to use for the upper and lower boundaries for this algorithm would require more annotated stories to do a proper analysis, and is therefore outside the scope of this thesis.

4.3.4 Using rule probabilities

As we saw in section 4.3.2, rules contain the following information:

• action • subj • obj (optional) • dat (optional) • prec • eff • source

Essentially, probabilities can be computed for the occurence of every variable in the rule object, and for every combination of rule object variables. Some interesting possibilities are:

• Comparison between action and obj, subj or dat: This way a generation program can obtain the knowledge of how characters interact with the action (for example, the probability that a princess will marry is high, the probability that a princess will murder someone is low ( p(action = ‘‘marry’’ | subj = ‘‘princess’’)  p(action = ‘‘murder’’ | subj = ‘‘princess’’)))

• Comparisons between the different obj, subj and dat of the same action: For example, character X (the prince) and character Y (the caliph) are often the subject of the same action A (marriage) (in probabilistic terms p(subj = ‘‘prince’’ | action = ‘‘marry’’) ≈ p(subj = ‘‘caliph’’ | action = ‘‘marry’’) ). Perhaps these characters are similar to each other (they fulfill the same type of function in stories) and could be substituted in the same action (if the prince usually marries a specific character (the princess) most of the time, perhaps a caliph could also marry this character) or different actions (if the prince has a high probability of slaying dragons, the caliph might also be able to slay dragons, even if it has never been seen before).

(19)

• Comparison between combinations of obj, subj, dat over different actions: Another option would be to see which characters are connected, by seeing which characters often appear in the same actions. For example, princes and princesses frequently interact with eachother (across different actions such as one saving the other, marrying, etc.). This is true if

p((subj = ‘‘prince’’ ∧ obj = ‘‘princess’’) ∨ (subj = ‘‘princess’’ ∧ obj = ‘‘prince’’) ∨ (subj = ‘‘prince’’ ∧ dat = ‘‘princess’’) ∨ (subj = ‘‘princess’’ ∧ dat = ‘‘prince’’) ∨ (obj = ‘‘prince’’ ∧ dat = ‘‘princess’’) ∨

(obj = ‘‘princess’’ ∧ dat = ‘‘prince’’)) is higher than some threshold or higher than other character combinations.

This indicates that these characters often appear together, which might be useful when a future generation program needs to select new characters to introduce in a story (the reasoning being ‘There is already a princess in the story, it would make sense to introduce a prince character.’). This character selection process is important if the generation program needs to be able to make certain events happen. If the program started a story with a prince but not a princess, but then tried to include a stereotypical “prince marries princess” scene, then it would either have to rework the story extensively to include the princess in the existing plot, rewrite the story entirely to include a princess character, or choose to include a different event that would not fit as well as this one (judging by event probabilities).

(20)

5

Evaluation

As noted in the research question, the representation has to be suitable for generation purposes. This means that it should be able to recognize similarities in similar event types, both capturing the ways in which they are similar and how they are different (with respect to the preconditions and effects). The system has been tested on two stories: ‘The Frog Prince’ [13] and ‘Caliph Stork’ [17]. These stories were chosen since they are both from the same genre (fairy tales) and both stories contain a common story element (human to animal transformations). The stories were manually annotated by the author so they conformed to the state-action model proposed by this thesis. In section 5.1 the stories as annotated will be presented and the similarities and differences between them will be discussed, and in section 5.2 an example of rule extraction will be shown.

5.1

Dataset

As said in the introduction of this section, ‘The Frog Prince’ and ‘Caliph Stork’ were chosen since they are both from the same genre and both stories contain a common story element. In ‘The Frog Prince’ the titular prince starts as a frog and eventually becomes a human prince, in ‘Caliph Stork’ the caliph and his vizier start as humans, are changed into storks with a magic powder and both have to find a way to get back to human form. Since the stories have this common element, the program has to be able to handle this appropriately (extract similar rules for each occurence).

For consistency, the characters are refered to by the same name throughout the story. For example, the frog character starts as a frog, but later becomes a prince. However, the character is still referred to as the frog after the transformation. This was done so the state representation of the characters remained consistent. If the character would have been renamed to ‘prince’, the transformation event would look equivalent to the frog character disappearing and the prince character appearing (connected to all characters the frog character was connected to), which is not what actually happens (the frog character’s form is merely altered).

The actions of ‘The Frog Prince’ were as follows:

the frog promises the ball to the princess the princess promises companionship to the frog the frog gets the ball

the princess goes home. the princess has dinner with the king

the frog asks the princess for promise:2. the princess refuses promise:2 the king enforces promise:2

the princess uses companionship the frog transforms into a human the frog marries the princess

The actions of ‘Caliph Stork’ were the following:

the caliph buys the magic_powder caliph learns about magic_powder

caliph uses magic_powder. caliph says magic_word. the caliph transforms into an animal vizier uses magic_powder. vizier says magic_word. the vizier transforms into an animal the caliph listens to an animal

the vizier listens to an animal the caliph laughs

the vizier laughs

mirza becomes the lord_of_baghdad the caliph meets the owl

the vizier meets the owl SUBSTORY_BEGIN

king_of_the_indies denies kaschnur the owl transforms into an animal SUBSTORY_END

caliph learns the magic_word vizier learns the magic_word caliph transforms into a human vizier transforms into a human caliph marries the owl

the owl transforms into a human caliph kills kaschnur

(21)

For readability only actions were given here. In appendix B the full stories with the states can be found. Even though both stories contain transformations, they vary in complexity with respect to the prerequisites. In Caliph Stork, the transformation was done with a magic powder, the character had to remember a magic word, and if the character laughed while in animal form, they forgot the magic word and could not change back. This is explicitly told to the caliph, and by extension, to the reader. However, in ‘The Frog Prince’ there are also certain prerequisites for the frog to become a prince again, but these are never explicitly stated (did the frog have to be kissed by a princess, or would any person, male or female, do?). Because of this, no special annotation has been added to the states directly before and directly after the magic transformation in ‘The Frog Prince’, which should result in a much simpler set of prerequisites compared to Caliph Stork.

5.2

Extraction of a rule for transformation

To evaluate if the program was able to capture both the similarities and the differences between the same actions in different stories, it was given both stories with the states annotated according to the annotation scheme described in section 4.2.1 and the actions in simplified natural language. The only other information it was given was the grammar to parse the action sentences.

The program written for this thesis was able to find 8 occurences of a transformation in both stories. There is one animal to human transformation in ‘The Frog Prince’, and there are 4 transformations from human to animal and 3 transformations from animal to human in ‘Caliph Stork’. The example from ‘The Frog Prince’ (where the story event is ‘the frog transforms into a human’) looks as follows:

OBJ = ‘human’ SUB = ‘frog’ PREC = [ (‘SUB’, ‘SUB_race:animal’), (‘SUB_abilities:ball’, ‘SUB’), (‘SUB’, ‘SUB_abilities:ball’), (‘SUB_race:animal’, ‘SUB’) ] EFF = { ‘edges_gone’: [ (‘SUB’, ‘SUB_race:animal’) ], ‘edges_appeared’: [ (‘SUB_race:OBJ’, ‘SUB’) ] }

A similar situation, where the caliph in ‘Caliph Stork’ transforms from animal to human form is given here (The story event being ‘caliph transforms into a human’):

OBJ = ‘human’ SUB = ‘caliph’ PREC = [ (‘SUB_abilities:magic_powder’, ‘SUB’), (’enemy:1’, ‘kaschnur’), (‘SUB_abilities:magic_powder’, ‘rule:know(x,magic_word)&&speak(x,magic_word)&&animal(x)->OBJ(x)’), (‘SUB_abilities:magic_powder’, ‘rule:know(x,magic_word)&&speak(x,magic_word)&&OBJ(x)->animal(x)’),

(‘SUB_abilities:magic_powder’, ‘rule:animal(x)&&laugh(x)->not(know(x, magic_word))’), (‘SUB_abilities:wealth’, ‘SUB’),

(‘SUB’, ’enemy:1’),

(‘SUB’, ‘SUB_race:animal’), (‘SUB’, ‘SUB_abilities:wealth’),

(‘SUB’, ‘SUB_abilities:know(SUB, magic_word)’), (’enemy:1’, ‘SUB’),

(‘SUB_abilities:know(SUB, magic_word)’, ‘SUB’), (‘SUB’, ‘SUB_abilities:magic_powder’),

(‘SUB_race:animal’, ‘SUB’) ]

(22)

‘edges_gone’: [ (‘SUB’, ‘SUB_race:animal’) ], ‘edges_appeared’: [ (‘SUB’, ’enemy:1’), (‘SUB_abilities:wealth’, ‘SUB’), (‘kaschnur’, ’enemy:1’), (‘SUB_race:OBJ’, ‘SUB’) ] }

Another example of the same rule is from earlier in the story, when the caliph transforms from human to animal by using a magical powder:

OBJ = ‘animal’ SUB = ‘caliph’ PREC = [

(‘SUB_abilities:know(SUB, magic_word)’, ‘SUB’), (‘SUB_abilities:magic_powder’, ‘SUB’), (‘SUB’, ‘SUB_race:human’), (‘SUB_abilities:magic_powder’, ‘rule:know(x,magic_word)&&speak(x,magic_word)&&OBJ(x)->human(x)’), (‘SUB_race:human’, ‘SUB’), (‘SUB_abilities:lord_of_baghdad’, ‘SUB’), (‘SUB_needs:speak_with_animals’, ‘SUB’), (‘SUB_abilities:wealth’, ‘SUB’), (‘SUB’, ‘SUB_abilities:wealth’),

(‘SUB’, ‘SUB_abilities:know(SUB, magic_word)’), (‘SUB_abilities:magic_powder’, ‘rule:know(x,magic_word)&&speak(x,magic_word)&&human(x)->OBJ(x)’), (‘SUB’, ‘SUB_needs:speak_with_animals’), (‘SUB’, ‘SUB_abilities:magic_powder’), (‘SUB’, ‘SUB_abilities:lord_of_baghdad’), (‘SUB_abilities:magic_powder’, ‘rule:OBJ(x)&&laugh(x)->not(know(x, magic_word))’) ] effects: { ‘edges_gone’: [ (‘SUB’, ‘SUB_race:human’) ], ‘edges_appeared’: [ (‘SUB_abilities:wealth’, ‘SUB’), (‘SUB_race:OBJ’, ‘SUB’) ] }

There are similarities between all three occurences. They all share one of the effects, namely that the race of the subject becomes the object (‘SUB race:OBJ’, ‘SUB’). The fact that the same effect was extracted from these three very different cases indicates that the program has extracted a general rule for these transformations, which is useful in a generation scenario where the program wants to generate a transformation where the object that the person has been transformed in has not been observed in another story (for example, if a person transforms into a tree, this rule could still be used to deduce that the person’s ‘race’ becomes ‘tree’, even if person to tree transformations were not observed in other stories).

Another common property of these rules is that the subject loses their own race (this is denoted by (‘SUB’, ‘SUB race:animal’) being one of the effects of the transformation in the first two examples and (‘SUB’, ‘SUB race:human’) being the effect in the third example). However, this similarity is less pronounced than the previous one, since the race the character started out with was not specified in the action. The first example was obtained from the story event ‘the frog transforms into a human.’. If the story event had consistently been in the form of ‘the frog transforms from an animal into a human.’, then the resulting rule that would have been learned would have been more general like the previous rule, since the race that the frog used to have (animal) would have its own variable, making it more similar to a transformation in the opposite direction (for example the caliph transforms into an animal).

(23)

As said earlier in this section, the transformations in ‘Caliph Stork’ were different from the one in ‘The Frog Prince’, since in ‘Caliph Stork’ there was a magical powder with its associated rules (the character using the powder had to speak a magical word to transform, and would forget the word if they laughed in animal form), while in ‘The Frog Prince’ there was no explicit rule governing the magic. The rules of this magic powder can be seen in the preconditions, since they were also represented as rule nodes connected to the characters who used the powder to transform. For ‘The Frog Prince’ there was no specific rule, so there are no additional rules added to the precondition. In a generation scenario, the program could choose between these examples, either generating a scenario with complex magical rules (as in ‘Caliph Stork’) or a scenario without these rules (like in ‘The Frog Prince’). This highlights that though the knowledge base is able to recognize regularities in the data (like the changing of the subject’s race), it is also able to represent diversity in its rule system (a generation program has access to diverse examples of variations within the same rule).

Of course, the evaluation has been done on just two stories, since the annotation for now is a time-intensive process. Because of this no actual story generation has been done, but this thesis should be seen as more of a proof of concept: patterns can be recognized, and if more annotated stories were available (either through annotation or, more feasibly, through more sophisticated natural language processing), the program could learn more interesting patterns. When it is possible to automatically annotate the stories, it should be more feasible to generate actually interesting stories, since the program will be able to learn a larger amount and variety of rules.

Referenties

GERELATEERDE DOCUMENTEN

Others retain the potential of cross-cultural comparison, but only in so far as arguing that shared properties of the human mind create similar patterns in material culture

Ook in 1997 reden deze jonge mannelijke bestuurders in Utrecht (met 3,5% overtreders) minder onder invloed van alcohol dan oudere mannelijke bestuurders, maar het verschil was

Existing social network extraction methods only work within a well-defined context, e. academic publications or OSNs. Others re- quire manual input in the form of an entity list or

34 screening of the ideas as too difficult or too time consuming which can lead to a situation in where they seem to neglect the process of rating and commenting on designs (CSD

The independent variables are measured by; Management ownership (MANOWN), Board ownership (BOARDOWN) inside ownership (INSIDEOWN ) as the absolute difference in percentage

For the orienteering problem Tasgetiren et al.[9] constructed a Genetic Algorithm. The results they show are promising, obtaining best known solutions to a number of albeit

Moralism then, can involve unsympathetic or uncharitable reactions to another ’s action or the making of moral judgements in situations where they are inappropriate. 577)

Table 2 indeed demonstrates that more (older) Western European countries voted together with the UK than (newer) Eastern European member states. They also opposed more votes. Based