U snea: An Authorship Tool for Interactive Fiction using Retrieval Based Semantic Parsing (2020)

Abstract: The reader of a choose your own adventure novel and the user of a modern virtual assistant have a subtle similarity; both may, through the right lens, be viewed as engaging with a work of Interactive Fiction. This literary form emerged in the 1970s and has grown like a vine along the branch of modern technology, one guided by the advances of the other. In this work we weave together threads from the Interactive Fiction community and neural semantic parsing for dialog systems, defining the data model and necessary algorithms for a novel type of Interactive Fiction and open sourcing its accompanying authoring tool. Specifically, our work integrates retrieval based semantic parsing predicates into the branching story structures well known to the Interactive Fiction community, relaxing the relatively strict lexical options of preexisting systems.

## introduction interactive fiction (if) is a diverse genre of art and entertainment that is most well known in the context of video games, from text adventures (e.g. zork), to classic point and click adventures such as monkey island to award winning modern games like 80 days (time magazine game of the year 2014). less familiar to the general public is the literary tradition that recognizes if as high art on par with the novel and poem, and produces compelling work collected in ever-growing online repositories 1 . the signature techniques of if include branching story structure, multiple endings, and the use of lamps to solve complex problems. if was born, they say, in 1979 as advent, a text based cave exploration game written by a father to amuse and delight his daughters @xcite . over the last 40 years, the interactive affordances of technology have grown from text in a terminal to include modern marvels such as graphics, audio, touchscreens, virtual reality, and speech recognition, and with their added complexity has come the creation of authorship software that allows nontechnical authors to harness these media. this is exemplified in inform foot_0 , a compiled programming language whose lines of code are themselves grammatical english sentences. authorship tools for if define some structure of a story and provide suggested algorithms or software itself to realize this structure in a form that a reader can digest, which taken together we will call a model specification. our particular model specification is inspired by recent work in neural dialog systems for virtual assistants. while advent and alexa may seem to have little in common, they are both clearly a turn taking interaction between a system and a reader foot_1 . their internal workings are also similar, as it is no coincidence that the sub-genre of parser games like zork shares a token in its name with the semantic parsers used in a dialog agents; they share the common ancestor of tree-structure parsers from the early days of computational linguistics @xcite . we make use of retrieval based semantic parsing @xcite , a variant of nearest neighbor classification using inverse semantic similarity as its distance metric. one particular strength of this method is that the semantic similarity metric, or semantic kernel @xcite , can be pretrained on general domain text pairs. instantiating a domain specific semantic parser is tantamount to the definition of exemplars, strings paired with class labels that indicate their known semantics. crucially, this is a task that can be done with no machine learning or programming background. it also avoids explicit formal semantic representations such as framenet @xcite , eliminating the learning curve required to bootstrap supervised discriminative semantic parsing systems such as @xcite . our model grants the reader a more freeform mode of interaction compared to many other examples of if; as long as the author can guide and anticipate the readers' inputs into close neighborhoods of their exemplars, the reader can both decide what to say and how to say it. for the author, we optimize for efficiency with features that collapse common patterns observed in user testing and components designed for the iterative tuning of the semantic parser exemplars. we also consider a third user type, the programmer who wishes to extend our open source library, by implementing our tool in angular with extensive modularity via dependency injection. the general tool architecture is as an appengine hosted website, with firebase for persistance. ## related work in nlp literature, perhaps the closest touchpoint to this work is @xcite , where a open domain chatbot is constructed by crowdsourcing appropriate responses for known chat histories. they describe a nightly iteration process in which the day's user utterances are clustered using a similarity function into paraphrase clusters and then passed to crowdworkers to provide appropriate followup system turns. they incrementally grow a directed graph based chatbot model of a similar structure to our own, but approach the authorship process in a drastically different manner and target only the desiderata of chitchat dialog as opposed to the general class of if. @xcite also creates a directed graph editing tool for dialogs, with api hooks allowing the control of lego mindstorms robots. while this application would at first glance seem quite different, the data model is similar. the visual similarity of our tools alone demonstrates their near isomorphism; in both cases the authorship process is tantamount to the definition of a graph topology and the filling of schema for graph components. the major difference arises instead from our use of retrieval based semantic matching and focus on if. our use of retrieval based (or paraphrase based) methods draws from recent work in semantic parsing @xcite and one-shot classification @xcite powered by the growing availability of general domain semantic similarity training data @xcite ) @xcite . one notable addition in our work is the introduction of anti-examples for tuning parser quality. ## model specification our model can be considered a marriage between the intuitive design principles of twine and modern methods in dialog systems. a typical dialog system design consists of components responsible for language understanding, dialog management, and language generation @xcite . ## authoring tool authoring under our model specification requires both defining the topology of a directed graph and filling the schema of node and edge properties (figure 1 ). some schema fields have complex types, which have multiple isomorphic data models of negligible difference provided they fulfill their functional purpose. mutations specifies a set of string to string map mutations and condi-tions a set of simple boolean key/value lookups, while matchcandidates are tuples of exemplar strings and booleans indicating if they are antiexamples. ## discussion we present a flexible model specification for a new flavor of interactive fiction inspired by recent trends in retrieval based dialog systems, and provide an accompanying authorship tool. our tool is deployed as an appengine app, is written in angular, and is open source foot_4 . our model specification makes use of semantic matching based predicates to traverse a directed graph, tracing out a "reading" of the piece. the use of semantic matching allows active reader ideation of their role while remaining within guard rails that maintain narrative cohesion. furthermore, its use of text based exemplars in a non-parametric model with a pretrained semantic kernel permits the iterative tuning of the semantic parsing system by an author with no programming or machine learning background. interactive fiction is an art form with an uncertain future that is connected in no small way to its proximity to games and the social norms separating games and fine art. @xcite muses that if may either be like american poetry waiting for its walt whitman, or like the cutup poetry fad of the beat poets, bound for obscurity. they perhaps did not expect that the question would remain unanswered for thirty years. we hope foremost that authors will enjoy using our tool to create something they care about, and that readers will enjoy their creations.