Knowledge Base | Act
Bard, The Automatic Storyteller
|Bard is an Automatic Storytelling application, completely implemented in Object-Oriented Programming (OOP). It has a structure-oriented knowledge model and a set of atomic operators implemented as extensibles trees of classes. |
The purpose of this project is to explore the possibilities of OOP creative systems in the field of automatic generation of stories.
Picture: Maler der Grabkammer des Nacht at Wikipedia.
From an engineering point of view, this application is a testbed for exploring the use of OPP in the implementation of creative systems. For this purpose, the program is divided in two parts: the knowledge models (subdivided in different but connected domains of knowledge) and the logical operators of the application.
While the model is based on a well-known composition pattern of classes, that are organized in a hierarchical fashion, the operators capture the semantic of the creative processes involved in the generation of new and valuable stories.
The set of operators that are modelled in the Bard application can be extended, but the main groups are:
- Selectors: used for selecting an individual that can be found into the structure of another individual (e.g. a story in a corpus of stories, a character in the cast of a story, etc.).
- Editors: used for editing the basic data, attributions and relations of and individual in order to enrich it and connect it with other individuals of the same context.
- Storers: used for loading/saving the individuals in the file system, providing a persistence layer.
- Comparers: used for comparing two individuals, providing meassures that are useful for searching, evaluating and even generating individuals.
- Searchers: used for searching an individual that can be found in the context of other individuals (e.g. a story between a list of stories).
- Generators: used for generating a new individual. Generators are key operators for creativity and can use other operators for auxiliar tasks. They also receive different parameters, depending if the generator must start from scratch, from one or more seeds (individuals that are used as starting points for the generation) or one or more evaluation criteria.
- Viewers: used for viewing an individual, usually in a text form that is understandable to the user (e.g. a story presented as a short list of simple English sentences).
- Evaluators: used for evaluating an individual according to some criteria (e.g. value of a story as a coherent narration, novelty of a character considering a set of similar characters that appears in other stories, etc.).
jBard is the implementation of the Bard application using only Java standard plus one additional library of open source software (JUnit) for testing.
The purpose of using Java is to simplify the reusability and extensibility of the application. What jBard offers is a framework of Java classes and a pre-established workflow for the code of other developers to reuse creating other storytellers in different domains of knowledge or with different operational features.
The two main packages of jBard are es.ucm.disia.bard.model.* and es.ucm.disia.bard.logic.*. In the first one only classes representing domain elements are included, implementing a set of interfaces meaning what type of operations can be performed over each element of the story. The second packages contains classes of logical operators, which really do the “creative job” dealing with those elements of the story that implement the appropiate interfaces.
In the current prototype, some operators are following a simple approach. Storage operators deal with files that are loaded and saved in binary format using Java serialization mechanisms. View operators use simple template-based approaches for generating the “natural language” necessary for showing a story to the user.
In this section the main window of the graphic user interface (GUI) is shown, explaining what is the funcionality of the application and how the different operations can be performed by the user.
In the screenshot, a file containing some Russian folk tales of the popular Alexander Afanasiev’s Collection has been loaded, and the story called “The Magic Swan-Geese” is currently selected.
At the bottom of the window there is a panel for managing the different corpora of stories. From left to right the element are:
- The Selection combo box for selecting the active corpus from the different corpora loaded in memory.
- The Create button for creating a new corpus.
- The Edit button for editing the active corpus (e.g. adding new stories).
- The Load button for loading corpora from files in the hard disk.
- The Save button for saving corpora to files in the hard disk.
At the right side of the window there is a panel for managing the different stories of the active corpus. From top to down the elements are:
- The subpanel for selecting, creating and editing stories. It contains:
- The Selection combo box for selecting the active story from the different stories containted in the active corpus.
- The Create button for creating a new story.
- The Edit button for editing the active story.
- The subpanel for searching stories. It contains:
- The Title text field for writing the title of the story that the user wants to find in the active corpus.
- The Title/Most similar to this one radio buttons for chosing between a search based on the title of the story or a search based on a similarity measure that compares the active story with the others stories of the active corpus.
- The Search button for starting the search of the story.
- The subpanel for generating stories. It contains:
- The Randomly from scratch/this one radio buttons for chosing between a random generation starting from scratch or using the structure of the active story as a seed for creating the new one.
- The Generate button for starting the generation of a new story.
- The subpanel for viewing stories. It contains:
- The Text in English/Spanish radio buttons for chosing between a textual visualization of the active story using English templates or Spanish templates for a basic representation in natural language.
- The View button for viewing the active story in a separate window.
- The subpanel for evaluating stories. It contains:
- The Value/Novelty check boxes for selecting what type of evaluation should be performed over the active story: an assesment of the value of the story, an assesment of the novelty (c-creativity) of the story (considering the other stories of the active corpus) or both.
- The Evaluate button for evaluating the active story.
Finally, two stories generated by jBard are presented. Titles are the only text that has not been generated automatically.
The Princess and the Lioness Once upon a time... there was a princess. The princess said not to go outside. The princess went outside. The princess heard about the lioness. The lioness scared the princess. The lioness kidnapped the princess. The knight departured. The knight and the lioness fought. The knight won the fight. The knight solved the problem of the princess. The knight returned. A big treasure to the knight.
The Frog and the Self-Sacrificing King Once upon a time... the frog fell in the trap of the witch. The witch scared the frog. The witch used a magic spell against the frog. Others and the king heard about the witch. The king heard something. The witch heard about the king. The king shared information with others. The knight departed. The knight fell in the trap. The witch enchanted the knight. The frog returned.