<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Tokamak Elementary: Visual Novel Meets Natural Language Understanding</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Daniel Darabos</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Gyorgy Lajtai</string-name>
        </contrib>
      </contrib-group>
      <abstract>
        <p>“Tokamak Elementary” is a game built around a custom conversational engine. The player can talk with “Toki”, the AIcontrolled character as with a chatbot. Toki is a gentle spirit creature summoned from the world of spirits. As such, Toki starts from a mostly clean slate and it's up to the player to teach them basic concepts of our world (such as what animals are) and how to interact with humans (such as returning greetings). One part of the game is a sandbox environment where the player chats with Toki in freeform natural language. (Figure 1) This part is fun because the player can interact with a goofy AI and teach it things. (Consider (Lionhead Studios 2001).) The other part of the game is a school Toki has to go and pretend to be a human. This part is a non-interactive scripted visual novel with a branching dialog tree. (Figure 2) This part is fun because of a complex plot involving school children, magical creatures, and fusion reactors. The novelty of the game comes from the interaction of these two parts. At school Toki's conversational engine gets the dialog from other characters as input. Toki answers according to its engine, just like when speaking to the player. The dialog branches are selected by simple checks on Toki's output. (Usually via regular expressions.) Gameplay alternates between the two parts. Toki goes to school, faces challenges and initially fails them. The player then gets to talk to Toki at home and teach them new facts and rules. When the player sends Toki back to school, they will go through the same day (same dialog tree), but Toki will give different responses due to an updated knowledge base. This will lead to new branches of the dialog tree and eventually a successful completion of the day.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        The school setting is an opportunity for real educational
content. In our video walk-through of the demo
        <xref ref-type="bibr" rid="ref1">(Darabos 2020)</xref>
        we meet Sophie, the music teacher who explains the
chromatic scale and a musical interval. Tokamak Elementary does
not directly quiz the player, but progress is gated behind Toki
achieving good grades. The player is tasked with explaining
real-world concepts to Toki. Sometimes teaching someone
else is the best way to learn a lesson ourselves.
      </p>
      <p>Our conversational engine parses inputs based on a
constituency parse tree generated by the Berkeley Neural Parser
(Kitaev and Klein 2018). The parse tree is recursively</p>
      <p>matched against the parse trees of all rules stored in Toki’s
knowledge base. The best matching combination of rules is
executed. The rules query and update the knowledge base
and craft a response. There are rules that allow the player to
add new rules, for example teaching Toki to say ”hello” when
greeted.</p>
      <p>The neural network-based parsing approach allows some
flexibility in the input. But we can’t hope to understand all
possible inputs. While providing a challenge and telling an
interesting story, the visual novel part also serves to
demonstrate to the player the kind of grammar structures that Toki
understands. (Figure 3)
Crafting a response is also challenging. The rules give
example responses, and our engine performs substitution according
to the actual rule execution context. We use SpaCy (Honnibal
and Montani 2017) to tokenize and tag the template sentence
and Pattern (Smedt and Daelemans 2012) for conjugation to
match the target tags.</p>
      <p>Tokamak Elementary is under development. The focus so far
has been on demonstrating that the basic concept works. We
have a playable demo that includes the sandbox mode and
a single short day at school. (As shown in the video
walkthrough.) We plan to add more days with a gradual ramp up
of difficulty and an unfolding of the story. When we add new
scenes, we add grammar and knowledge representation
features as needed. (Such as past tense and a concept of
timelines.) This accumulation of natural language understanding
also improves the sandbox chat experience.
Honnibal, M., and Montani, I. 2017. spaCy 2: Natural
language understanding with Bloom embeddings,
convolutional neural networks and incremental parsing. To appear.
Kitaev, N., and Klein, D. 2018. Constituency parsing with a
self-attentive encoder. CoRR abs/1805.01052.</p>
      <p>Lionhead Studios. 2001. Black &amp; white. [CD-ROM].
Smedt, T. D., and Daelemans, W. 2012. Pattern for python.
Journal of Machine Learning Research 13(66):2063–2067.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Darabos</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          <year>2020</year>
          .
          <article-title>Tokamak elementary demo 2020</article-title>
          . https://www.youtube.com/watch?v=
          <volume>5</volume>
          <fpage>V5fDM9lrI</fpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>