<!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>An Open Framework to Develop and Validate Techniques for Speech Analysis</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Luca Buoncompagni</string-name>
          <email>luca.buoncompagni@edu.unige.it</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>Fulvio Mastrogiovanni</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>University of Genoa</institution>
        </aff>
      </contrib-group>
      <abstract>
        <p>This paper presents the Concept-Action Grammar Generator (CAGG) system, which is an open source framework for natural speechbased interaction to be used in the semantic analysis of sentences. The goal of our framework is two-fold: i) to deliver a formalism associating a context-aware semantics to the words in a sentence; ii) to provide a common framework to benchmark different implementations of evaluators with the aim of improving speech-based interaction. To this aim, CAGG includes a specifically designed formalism for grammars definition as well as parsing mechanisms to automatically create and evaluate their structure. CAGG implements a deterministic evaluator which provisional performance related to a number of natural queries is discussed in terms of correct semantic associations and computational time.</p>
      </abstract>
      <kwd-group>
        <kwd>Speech analysis</kwd>
        <kwd>Natural speech-based interface</kwd>
        <kwd>Humanrobot interaction</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>We make, as human beings, a large use of speech-based interaction in organising
our daily activities, teaching to someone else how to do something, understanding
other people’s interests, or asking for help in difficult situations. Therefore, a
natural and context-aware speech-based interaction if fundamental for
humanrobot interaction and collaboration as well.</p>
      <p>
        There is no shortage of advanced speech-to-text systems, both as open source,
e.g., CMU Sphinx [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ] and HTK [
        <xref ref-type="bibr" rid="ref10">10</xref>
        ], and well-known commercial products such
as Google Now [
        <xref ref-type="bibr" rid="ref9">9</xref>
        ], Microsoft Cortana [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ], Siri [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ] and Alexa [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. On the one
hand, these systems rely on formal grammar specifications, advanced data
processing techniques, web searching and machine learning to provide services to
their users. On the other hand, there is no widespread consensus about how to
deal with the typical ambiguities we employ during communication and
clarifying conversations, which are due to the common sense knowledge we imbue our
speech-based interactions with. When interacting with robots, it is often the case
that contextualised knowledge is available as robot’s belief and it is reasonable
for a robot to exploit such information to better understand a human sentence.
! start &lt;M&gt;;
&lt;M&gt; : &lt;R1&gt; {@?;@ ;}
      </p>
      <p>| &lt;R2&gt; {@T;@bb;};
&lt;R1&gt; : (hi | hello);
&lt;R2&gt; : !optional(good{@!T;}) bye
| !repeat(bye{@!!;},1,2);
@«R1\hello», hello
@«R1\hi», hi
@«bb», good
@«T\bb», bye
x-or
x-or
or
x-or
and
x-or</p>
      <p>
        An open source framework to generate grammars and to easily prototype
and benchmark sentence evaluators is of the utmost importance. In this paper,
we propose the Concept-Action Grammar Generator (CAGG) framework, which
allows for: i) the context-aware semantic tagging of words in a sentence based on
a specified grammar, and ii) developing and validating different evaluators.
Semantic tagging is the approach we adopt to combine different knowledge sources,
e.g., the knowledge a robot may have about its environment and the context.
CAGG comes with a deterministic multi-thread implementation of a grammar
evaluator for a basic speech-based interaction, and it is available open source1.
2 System’s Architecture and Information Flow
The CAGG framework adopts an ad hoc language based on the Backus-Naur
Form syntax [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. The language defines a grammar with rules and sub-rules
(identified by &lt; and &gt;), which represent a logic expression as a binary tree. Rules have
a head and a tail, separated by :. Within rules, a number of context-aware
directives can be introduced, denoted by !. In particular, !start specifies the root
of an expression, !optional identifies its optional parts, and !repeat enables
looping over an expression within a lower and an upper bound on the range. Each
line always ends with ;. Sub-rules or terms (i.e., words in a sentence, which are
an expression’s leaves) can be aggregated using: an empty space, ‘ ’ (to denote
an and logical operator), or | (which is a x-or operator). It is noteworthy that
CAGG also supports C-like comments and annotations. Each rule or term can
be semantically tagged using {@: : :;: : :}, which specifies an array of symbols
activated in a verified parsed path. Special tags can be used using ?, which is
replaced during compilation with the rule’s head or term. To indicate that the
last tag must be augmented with the path’s leaf, one can use . Furthermore, a
tag can be removed with !, while !! clears the tag list.
      </p>
      <p>Figure 1 shows a simple example of the CAGG syntax, which defines a
grammar having at least a solution containing the tags: R1 if the input is “hi” or
“hello”, as well as «T\bb» if “bye” is given or «bb,T\bb» for “good bye”, whereas
“bye bye” returns «». Accordingly, a tree representation is sketched in Figure 2.</p>
      <p>
        Figure 3 shows the CAGG architecture. In order to build a grammar
evaluator, CAGG implements a parsing procedure (based on ANTLR [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]) able to
1 See: https://github.com/EmaroLab/concept_action_grammar_generator.
Parser
      </p>
      <p>ETs Grammar</p>
      <p>Generator</p>
      <p>Tag
Commands List
Activator</p>
      <p>ST</p>
      <p>Formatter
Speech-to-Text</p>
      <p>Evaluator</p>
      <p>STIs
generate an Abstract Syntax Tree (AST) for each rule. Each AST is
transformed in a binary Expression Tree (ET) via syntax manipulation and, finally,
the Grammar Generator module builds a unique Semantic Tree (ST) (e.g.,
Figure 2) by associating semantic tags to leaves (i.e., words) and all composition
of rules to tree paths. The process can be supervised through a Graphical User
Interface and stored in memory.</p>
      <p>
        When audio information is given, a speech-to-text interface (in the current
system we use the Google Speech API [
        <xref ref-type="bibr" rid="ref8">8</xref>
        ]) is used to determine the most likely
corresponding text string. The string must be formatted. A recursive function
generates different Semantic Tree Instances (STIs). In each instance, leaf nodes
are initialised with a Boolean value by matching the word with the
corresponding leaf in the ST. Each STI represents a possible solution that must be feasible
in terms of words consequentiality and robustness with respect to non modelled
words. Our current implementation searches for all the possible solutions
recursively reducing the sentence by removing the first words until the sentence itself is
empty. In this procedure, the Formatter module searches for the occurrences of
each word in the leaves and manages possible multiple usages of the same term
(e.g., “bye bye” in Figure 1 and 2) using a depth first approach. It is noteworthy
that the implementation of such an algorithm strongly affects the overall
system’s performance thus, current work is focused on exploring other approaches.
Again on Figure 3, as soon as a new STI is generated it is provided to the
Evaluator module, which computes the logical expression from the leaf to the root,
by adopting an any-time approach. If the root is in true state, the solution is
satisfied and all the semantics tags related to the true leaves are returned as an
array. Finally, the Commands Activator module is in charge to map such an
array of semantic symbols into application-based services.
      </p>
      <p>CAGG proposes a framework for the analysis and evaluation of different
approaches to grammar definition and evaluation, and provides a method to
event-based action generation which employs the analysis of sentences, by means
of the tags array. It allows designers and engineers to implement new Formatter
or Evaluator modules based on the ST-based representation.
3</p>
    </sec>
    <sec id="sec-2">
      <title>Examples</title>
      <p>We discuss here a simplified grammar to analyse questions posed in English
(Figure 4). Table 1 contains a few examples, the corresponding computation
time and the resulting sentence analysis. We see how the same word can be</p>
      <p>! start &lt;MAIN&gt;;
&lt;MAIN&gt; : !optional(&lt;WH&gt;) &lt;QUERY&gt; !optional(&lt;OBJ&gt;{@Obj ;});</p>
      <p>&lt;WH&gt; : what | where;
&lt;QUERY&gt; : &lt;AUX&gt;{@? ;} &lt;OBJ&gt;{@Subj ;} &lt;VERB&gt;{@? ;}</p>
      <p>| &lt;VERB&gt;{@? ;} &lt;OBJ&gt;{@Subj ;};
&lt;BE&gt; : am | are | is;
&lt;HAVE&gt; : have | has;
&lt;BE-HAVE&gt; : &lt;HAVE&gt; | &lt;BE&gt;;
&lt;AUX&gt; : do | does | &lt;HAVE&gt;;
&lt;VERB&gt; : &lt;BE-HAVE&gt; | seen;
&lt;OBJ&gt; : &lt;PRONOUN&gt; | &lt;THING&gt;{@?;} | &lt;CONCEPT&gt;{@?;};
&lt;THING&gt; : robot | door;
&lt;CONCEPT&gt; : name | surname;
&lt;PRONOUN&gt; : I | you;
Do you have a name? 0.463 sec «AUX\do;Subj\you;VERB\Have;Obj\CONCEPT\name»
What have you seen? 0.238 sec «AUX\have;Subj\you;VERB\seen»
Are you a robot? 1.161 sec «VERB\are;Subj\you;Obj\THING\robot»
Are you a machine? 0.402 sec «VERB\are;Subj\you»
You are smart. 1.520 sec «»
interpreted according to different semantics on the basis of the question and
where it is in the parsing tree. Moreover, CAGG can deal with unknown words,
which can be identified for further assessments. It is possible to characterise
the worst case computation time, corresponding to a full parsing. This is very
important for real-world human-machine interaction scenarios.</p>
      <p>It is noteworthy that the Evaluator module may find also other solutions
based on the grammar’s definition. For example, in the grammar shown in
Figure 1, the input “bye” could generate solutions without any semantic tags (in
place of «bb»). This can happen when paths to such a term are verified. As an
example it would not happen if the directive !repeat(bye{@!!;},2,2) were
used, e.g., Figure 2. An idea to overcome this is to enable the Command
Activator module to improve sentences analysis over time, where the improvement is
related to the number of identified tags.
4</p>
    </sec>
    <sec id="sec-3">
      <title>Conclusions</title>
      <p>
        We propose the Concept-Action Grammar Generator (CAGG) system, an open
source framework for natural speech-based interaction providing an efficient
semantic sentences analysis. CAGG provides an open infrastructure to easily
prototype and implement grammar evaluators for benchmarking purposes. Current
work is focused on the integration with a system for spatial reasoning in
humanrobot interaction scenarios [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ].
      </p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1. Amazon:
          <article-title>Alexa voice service (AVS) (</article-title>
          <year>2016</year>
          ), https://developer.amazon.com/ alexa-voice-service
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2. Apple: iOS-siri (
          <year>2016</year>
          ), http://www.apple.com/ios/siri/
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Farrel</surname>
            ,
            <given-names>A.</given-names>
          </string-name>
          :
          <article-title>Routing backus-naur form (RBNF): A syntax used to form encoding rules in various routing protocol specifications (</article-title>
          <year>2009</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <surname>Lamere</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kwok</surname>
            ,
            <given-names>P.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gouvea</surname>
            ,
            <given-names>E.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Raj</surname>
            ,
            <given-names>B.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Singh</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Walker</surname>
            ,
            <given-names>W.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Warmuth</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wolf</surname>
            ,
            <given-names>P.:</given-names>
          </string-name>
          <article-title>The cmu sphinx-4 speech recognition system</article-title>
          .
          <source>In: IEEE Intl. Conf. on Acoustics, Speech and Signal Processing (ICASSP</source>
          <year>2003</year>
          ),
          <article-title>Hong Kong</article-title>
          . vol.
          <volume>1</volume>
          , pp.
          <fpage>2</fpage>
          -
          <lpage>5</lpage>
          . Citeseer (
          <year>2003</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <given-names>Luca</given-names>
            <surname>Buoncompagni</surname>
          </string-name>
          ,
          <string-name>
            <surname>F.M.:</surname>
          </string-name>
          <article-title>A software architecture for object perception and semantic representation</article-title>
          .
          <source>2nd Workshop on Artificial Intelligence and Robotics (AIRO)</source>
          (
          <year>2015</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6. Microsoft: What is cortana? (
          <year>2016</year>
          ), https://support.microsoft.com/en-us/ help/17214/windows-10
          <string-name>
            <surname>-</surname>
          </string-name>
          what-is
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Parr</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          :
          <article-title>The definitive ANTLR 4 reference</article-title>
          . Pragmatic
          <string-name>
            <surname>Bookshelf</surname>
          </string-name>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          8.
          <string-name>
            <surname>Shires</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wennborg</surname>
          </string-name>
          , H.:
          <article-title>Web speech api specification</article-title>
          .
          <source>Final Report, W3C</source>
          (
          <year>2012</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          9.
          <string-name>
            <surname>Stanford</surname>
            ,
            <given-names>V.M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Williamson</surname>
            ,
            <given-names>O.J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Sherwin</surname>
            <given-names>Jr</given-names>
          </string-name>
          ,
          <string-name>
            <given-names>E.B.</given-names>
            ,
            <surname>Castellucci</surname>
          </string-name>
          ,
          <string-name>
            <surname>F.V.</surname>
          </string-name>
          :
          <article-title>Continuous speech recognition and voice response system and method to enable conversational dialogues with microprocessors (Mar 25</article-title>
          <year>1997</year>
          ),
          <source>uS Patent 5</source>
          ,
          <issue>615</issue>
          ,
          <fpage>296</fpage>
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          10.
          <string-name>
            <surname>Young</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Evermann</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Gales</surname>
            ,
            <given-names>M.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Hain</surname>
            ,
            <given-names>T.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Kershaw</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Liu</surname>
            ,
            <given-names>X.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Moore</surname>
            ,
            <given-names>G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Odell</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Ollason</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Povey</surname>
            ,
            <given-names>D.</given-names>
          </string-name>
          , et al.:
          <article-title>The htk book</article-title>
          . Cambridge university engineering department 3,
          <issue>175</issue>
          (
          <year>2002</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>