<!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>
      <journal-title-group>
        <journal-title>Nantes, France
$ vadim@grammarware.net (V. Zaytsev)
 https://grammarware.net/ (V. Zaytsev)</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>Speak Well or Be Still: Solving Conversational AI with Weighted Attribute Grammars (Poster)</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Vadim Zaytsev</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Formal Methods and Tools, University of Twente</institution>
          ,
          <country country="NL">The Netherlands</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2022</year>
      </pub-date>
      <volume>000</volume>
      <fpage>0</fpage>
      <lpage>0001</lpage>
      <abstract>
        <p>There is a growing need to specify models of possible conversations with non-human entities. Such models have a dificult task to set the bar for correctness yet tolerate conversations with only partial conformance to it, and accommodate computations that non-human entities perform during the conversation on several possibly independent emergent models with unrelated flows of information in them. As it turns out, this is possible to specify formally in a fairly concise way with weighted attribute grammars [6]. In this paper, a variant of those is presented, called WAGIoT, that combines the power of analytic, generative, attribute, weighted and probabilistic grammars in one DSML. Conversation entities are an essential part of smart IoT systems. They come in many forms, largely synonymous: conversational AI, virtual digital assistants, interactive agents, smart bots, chatbots, etc. In the presence of the Turing test [17] as the ultimate goal of artificial intelligence, conversation programs became an iconic example of an AI system very early. Notable milestones shaping and eventually commoditising the trend, were ELIZA [19], PARRY [4], A.L.I.C.E. [18], Wolfram Alpha [20], IBM Watson [9], Siri [3], Cortana [12], Alexa [2], Google Assistant [7], Alisa [22] and Bixby [15]. Conversation agents are needed in many areas from smart homes to game design. We refer to the excellent recent overview of this research direction by Adamopoulou and Moussiades [1] and focus now on the relation between the linguistic component and the operational logic of the conversation entity. Looking at the problem linguistically, the conversation can be encoded as an automaton with states representing internal states of the conversation component, and transitions annotated with inputs (coming from the user or an edge device) and outputs (being sent to the user or to actuator). In the computation theory such automata are called Mealy machines [11] if they are deterministic and have a finite number of states. Both limitations are unfortunately too crippling, so all the substantial body of research on Mealy machines cannot be applied directly. What might be theoretically more feasible, is an input/output extension of pushdown transition systems or process rewrite systems [10], that can handle both infinite/uncountable number of states or transitions, have enough memory to handle complex tasks intelligently, and still represent a strict subclass of Turing machines such that reachability is decidable. The lack of available theories pushed people to consider hybrid setups. For instance, actual derivations can be handled by a grammar, but the grammar rules that get applied, must follow</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>an associated coloured graph [21] or a path in a Petri net [5]. The contemporary systems used
in the industry, like RiveScript [13], are also hybrid in nature: the conversation is specified
as request-response pairs (akin to the event-based paradigm in grammarware [23]) with ad
hoc computations on global data. Powerful of-the-shelf AI packages like Dialogflow [ 8],
lifting natural language understanding tasks to intents and their fulfillment, and using a smart
knowledge connector to incorporate existing data, allow these computations to be arbitrarily
complex. For example, Salvi et al build Jamura [14], a conversational smart home assistant using
Telegram API for collecting user input, Dialoglflow Agents for processing it and the ThingSpeak
platform to connect to the server and the clients.</p>
      <p>One of the heterogeneous approaches is binary context-free grammars [16] which combine
two generative grammars into one mathematical object. Essentially our proposal is to combine
attribute grammars (that can propagate and share data in a very controlled fashion), weighted
grammars (that provide highly controllable nondeterminism), analytic grammars (for parsing
user inputs) and generative grammars (for producing answers).</p>
      <p>Our domain-specific language for conversation models is called WAGIoT, and is in fact a
tailored implementation of Weighted Attribute Grammars [6]. It allows conversation designers
to specify interactions with actuators, sensors and users. A typical WAGIoT model can be seen
on Figure 1. There are many model transformations that infer enough information from this
provided model in order to make it formally executable. For instance:
◇ a synthesized attribute . in getname and an inherited attribute ˙ in time have the same
name; the given grammar is represented as a directed graph of nonterminals, in which
WAGIoT normaliser finds the shortest path between these two places and makes sure the
information is properly propagated;
◇ analytic nonterminals such as greet and stop have multiple branches, which get assigned
counters; these are increased each time a branch is chosen, and this information is always
available elsewhere—wherever there is a need to build a model of the human user’s
behaviour/speech patterns;
◇ all the unassigned weights are calculated based on available information; for instance,
time branch in rule 10 gets a probability (︀ 1 ∶ 1 + ︀⌋ because  is a dynamic value, so the
only option is to add the default 1; if rule 11 had the weight (︀ 1 ∶ 3⌋︀ instead of (︀ ︀⌋ , then
rule 10 would get a weight (︀ 2 ∶ 3⌋︀ to compensate for the missing static part;
◇ types of attributes are inferred:  is determined to be a string due to a built-in nonterminal</p>
      <p>Id, and  is an integer because it is used as weight;
◇ code blocks between J and K are expected to conform to a special interface with methods
responding to their use in generative and analytic contexts, and otherwise are lowered to
strings, which is what happens in rules 10–11.</p>
      <p>
        Our preliminary experiments show that these transformations hide details that otherwise
overwhelm those who are supposed to write such models. Although we claim that the simplicity
of RiveScript [13] pushes its users to combine it with informal hacks, exposing too much of the
complexity at once is just as damaging. More work is required to find the best balance, as well
as to pursue the obvious enhancements like replacing fixed terminals with signals from a NLP
model. Our ongoing endeavours are made public at https://github.com/grammarware/wagl.
(
        <xref ref-type="bibr" rid="ref2">2</xref>
        )
(
        <xref ref-type="bibr" rid="ref3">3</xref>
        )
(
        <xref ref-type="bibr" rid="ref4">4</xref>
        )
(
        <xref ref-type="bibr" rid="ref5">5</xref>
        )
(
        <xref ref-type="bibr" rid="ref6">6</xref>
        )
(
        <xref ref-type="bibr" rid="ref7">7</xref>
        )
(
        <xref ref-type="bibr" rid="ref8">8</xref>
        )
(
        <xref ref-type="bibr" rid="ref9">9</xref>
        )
(
        <xref ref-type="bibr" rid="ref10">10</xref>
        )
(
        <xref ref-type="bibr" rid="ref11">11</xref>
        )
(
        <xref ref-type="bibr" rid="ref12">12</xref>
        )

setup
greet
greet
greet
getname
getname
activity
time
time
time
stop
←
←
←
←
→
←
→
←
←
setup activity∗ stop.
greet? getname.
'hello'.
'good morning'.
'greetings, human!' 'what is your name?'.
'I am' . ∶= Id.
'nice to meet you,' ..
time ⋃︀ ⋯.
      </p>
      <p>'what time is it?'.
→ 'it is' J . K ',' ˙ ▶  ∶= 5.
→ ︀( ⌋︀ 'it is' J . . K 'o′clock' ▶  ∶=  − 1.</p>
      <p>← 'stop' ⋃︀ 'off'.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [1]
          <string-name>
            <given-names>E.</given-names>
            <surname>Adamopoulou</surname>
          </string-name>
          ,
          <string-name>
            <given-names>L.</given-names>
            <surname>Moussiades</surname>
          </string-name>
          ,
          <article-title>An Overview of Chatbot Technology</article-title>
          , in: AIAI, Springer,
          <year>2020</year>
          , pp.
          <fpage>373</fpage>
          -
          <lpage>383</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          [2]
          <string-name>
            <surname>Amazon</surname>
          </string-name>
          , Amazon Alexa Voice AI, https://developer.amazon.com/en-US/alexa,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          [3]
          <string-name>
            <surname>Apple</surname>
          </string-name>
          , Siri, https://www.apple.com/siri/,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          [4]
          <string-name>
            <surname>K. M. Colby</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          <string-name>
            <surname>Weber</surname>
            ,
            <given-names>F. D.</given-names>
          </string-name>
          <string-name>
            <surname>Hilf</surname>
          </string-name>
          , Artificial Paranoia,
          <source>Artificial Intelligence</source>
          <volume>2</volume>
          (
          <year>1971</year>
          )
          <fpage>1</fpage>
          -
          <lpage>25</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          [5]
          <string-name>
            <given-names>J.</given-names>
            <surname>Dassow</surname>
          </string-name>
          , S. Turaev, -Petri Net Controlled Grammars, in: LATA, LNCS 5196, Springer,
          <year>2008</year>
          , pp.
          <fpage>209</fpage>
          -
          <lpage>220</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          [6]
          <string-name>
            <given-names>M.</given-names>
            <surname>Gerhold</surname>
          </string-name>
          ,
          <string-name>
            <given-names>V.</given-names>
            <surname>Zaytsev</surname>
          </string-name>
          , Towards Weighted Attribute Grammars, Under review,
          <year>2022</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          [7]
          <string-name>
            <surname>Google</surname>
          </string-name>
          , Google Assistant, your own personal Google, https://assistant.google.com,
          <year>2016</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          [8]
          <string-name>
            <surname>Google</surname>
          </string-name>
          , Google Cloud: Dialogflow, https://cloud.google.com/dialogflow/docs/,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          [9]
          <string-name>
            <surname>IBM</surname>
          </string-name>
          , IBM Watson, https://www.ibm.com/watson,
          <year>2011</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          [10]
          <string-name>
            <given-names>R.</given-names>
            <surname>Mayr</surname>
          </string-name>
          ,
          <source>Process Rewrite Systems, Information and Computation</source>
          <volume>156</volume>
          (
          <year>2000</year>
          )
          <fpage>264</fpage>
          -
          <lpage>286</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref11">
        <mixed-citation>
          [11]
          <string-name>
            <given-names>G. H.</given-names>
            <surname>Mealy</surname>
          </string-name>
          ,
          <article-title>A Method for Synthesizing Sequential Circuits</article-title>
          ,
          <source>Bell System Tech Journal</source>
          <volume>34</volume>
          (
          <year>1955</year>
          )
          <fpage>1045</fpage>
          -
          <lpage>1079</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref12">
        <mixed-citation>
          [12]
          <string-name>
            <surname>Microsoft</surname>
          </string-name>
          , Your Personal Productivity Assistant, https://www.microsoft.com/en-us/cortana,
          <year>2014</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref13">
        <mixed-citation>
          [13]
          <string-name>
            <given-names>N.</given-names>
            <surname>Petherbridge</surname>
          </string-name>
          , RiveScript, https://www.rivescript.com,
          <year>2018</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref14">
        <mixed-citation>
          [14]
          <string-name>
            <given-names>S.</given-names>
            <surname>Salvi</surname>
          </string-name>
          ,
          <string-name>
            <surname>Geetha</surname>
            <given-names>V</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sowmya Kamath</surname>
            <given-names>S</given-names>
          </string-name>
          , Jamura:
          <string-name>
            <given-names>A Conversational</given-names>
            <surname>Smart</surname>
          </string-name>
          <article-title>Home Assistant Built on Telegram and Google Dialogflow</article-title>
          , in: TENCON, IEEE,
          <year>2019</year>
          , pp.
          <fpage>1564</fpage>
          -
          <lpage>1571</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref15">
        <mixed-citation>
          [15]
          <string-name>
            <surname>Samsung</surname>
          </string-name>
          , Bixby | Apps &amp; Services, http://bixby.samsung.com/,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref16">
        <mixed-citation>
          [16]
          <string-name>
            <given-names>S.</given-names>
            <surname>Turaev</surname>
          </string-name>
          ,
          <string-name>
            <given-names>R.</given-names>
            <surname>Abdulghafor</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Alwan</surname>
          </string-name>
          ,
          <string-name>
            <given-names>A. A.</given-names>
            <surname>Almisreb</surname>
          </string-name>
          ,
          <string-name>
            <given-names>Y.</given-names>
            <surname>Gulzar</surname>
          </string-name>
          , Binary Context-Free
          <string-name>
            <surname>Grammars</surname>
          </string-name>
          (
          <year>2020</year>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref17">
        <mixed-citation>
          [17]
          <string-name>
            <surname>A. M. Turing</surname>
          </string-name>
          ,
          <source>Computing Machinery and Intelligence, Mind</source>
          <volume>59</volume>
          (
          <year>1950</year>
          )
          <fpage>433</fpage>
          -
          <lpage>460</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref18">
        <mixed-citation>
          [18]
          <string-name>
            <given-names>R. S.</given-names>
            <surname>Wallace</surname>
          </string-name>
          , The Anatomy of
          <string-name>
            <surname>A.L.I.C.E.</surname>
          </string-name>
          ,
          <source>in: Parsing the Turing Test</source>
          , Springer,
          <year>2009</year>
          , pp.
          <fpage>181</fpage>
          -
          <lpage>210</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref19">
        <mixed-citation>
          [19]
          <string-name>
            <given-names>J.</given-names>
            <surname>Weizenbaum</surname>
          </string-name>
          , ELIZA
          <article-title>- A Computer Program for the Study of Natural Language Communication between Man and Machine</article-title>
          , CACM
          <volume>9</volume>
          (
          <year>1966</year>
          )
          <fpage>36</fpage>
          -
          <lpage>45</lpage>
          . doi:
          <volume>10</volume>
          .1145/365153.365168.
        </mixed-citation>
      </ref>
      <ref id="ref20">
        <mixed-citation>
          [20]
          <string-name>
            <surname>Wolfram</surname>
            <given-names>Research</given-names>
          </string-name>
          , Wolfram|Alpha: Computational Intelligence, https://www.wolframalpha.com,
          <year>2009</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref21">
        <mixed-citation>
          [21]
          <string-name>
            <given-names>D.</given-names>
            <surname>Wood</surname>
          </string-name>
          ,
          <source>A Note on Bicolored Digraph Grammar Systems, IJCM</source>
          <volume>3</volume>
          (
          <year>1973</year>
          )
          <fpage>301</fpage>
          -
          <lpage>308</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref22">
        <mixed-citation>
          [22]
          <string-name>
            <surname>Yandex</surname>
          </string-name>
          ,
          <article-title>Alisa - Voice Assistant from the Yandex company</article-title>
          , https://yandex.ru/alice,
          <year>2017</year>
          .
        </mixed-citation>
      </ref>
      <ref id="ref23">
        <mixed-citation>
          [23]
          <string-name>
            <given-names>V.</given-names>
            <surname>Zaytsev</surname>
          </string-name>
          ,
          <string-name>
            <surname>Event-Based</surname>
            <given-names>Parsing</given-names>
          </string-name>
          , in: REBLS,
          <year>2019</year>
          . doi:
          <volume>10</volume>
          .1145/3358503.3361275.
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>