" /> Nuance ASR Grammar on Composer - Genesys CTI User Forum

Author Topic: Nuance ASR Grammar on Composer  (Read 7535 times)

Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Nuance ASR Grammar on Composer
« on: June 18, 2019, 04:46:01 PM »
Advertisement
Hi guys,

We've been asked to develope an application than can take letters as input based on italian city names pronouced by the callers (eg. "R" for 'Roma').

It's the first time we use the Nuance ASR on Composer as it is freshly installed. I verified that using builtin grammars it actually works (eg. using "builtinNumber" I was able to detect numbers and store them in my output variable).

How can I build a proper grammar file in order to make Nuance ASR detect city names? Is there a specific grammar builder I can use? What is the correct Input block configuration when an external Grammar is being used? I'm referring to the samples provided in the Composer templates but I keep getting the "Speech Recognition Error was detected, Goodbye" message when I try to use the following grammar built with Composer:

[quote]<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="it-IT" root="codice" version="1.0" mode="voice">
    <rule id="codice" scope="public">
        <one-of>
            <item>
                <tag>out='Ancona'</tag>
                <one-of>
                    <item>
                        <token>Ancona</token>
                    </item>
                </one-of>
            </item>
            <item>
                <tag>out='Roma'</tag>
                <one-of>
                    <item>
                        <token>Roma</token>
                    </item>
                </one-of>
            </item>
        </one-of>
    </rule>
</grammar>[/quote]


Thanks for your replies!


Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #1 on: June 18, 2019, 05:22:38 PM »
Well you won't find such information on Composer as you are using a Nuance product. MCP is just a GW for it.
So you need to search for Nuance ASR samples. There is documentation for developers available at their site. Go for it, study it and practice a lot.
You can also ask into Nuance forums around.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #2 on: June 18, 2019, 05:24:55 PM »
And why don't just use Composer Grammar builder?

Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #3 on: June 19, 2019, 09:18:27 AM »
Hi Cavagnaro,

Thanks for you reply, you're always really helpful! :)

Sorry if I sound a little confused  and maybe unprepared... that's actually what I am because I've been recently assigned on this job with little to none knowledge about the matter, lot of work to do and no time to do it  ::)  ::) 

So please, help me understand... I received a lot of different but conflicting advices on the ASR. As far as I can tell Nuance is the engine used both for TTS and ASR. TTS works fine through Composer, but, as far as I can tell, ASR miss the proper grammar file in order to recognize words.

I need to understand first if I have to build a grammar and if this grammar can be build via Composer Grammar builder or it needs something else (eg. a Nuance grammar builder?)

[quote author=cavagnaro link=topic=11364.msg51831#msg51831 date=1560878695]And why don't just use Composer Grammar builder?[/quote]

from your message it seems that Composer Grammar builder should do the work, right?

I already tried to build a simple grammar (the quoted one from my previous message) but if I set this resource in the Input block in Composer configured as follow I get the error [i]"Speech Recognition Error was detected, Goodbye!"[/i]:

[quote]Grammar Type: externalGrammar
Input Grammar Dtmf:
Input Gramma Voice: 'cities.grxml'
Input Mode: voice
Slots:
[/quote]

What am I doing wrong?

Thanks and, again, sorry for my confusion.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #4 on: June 19, 2019, 11:31:30 AM »
Check at Nuance logs to see why it is not accepting the ASR grammar.
If you built it with Composer Grammar Builder, don't forget to click the Default option at the root. Otherwise you will need to specify the section as name.grxml#cities
Check the composer documentation.


Enviado de meu SM-G9650 usando o Tapatalk


Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #5 on: June 19, 2019, 02:23:54 PM »
[quote]If you built it with Composer Grammar Builder, don't forget to click the Default option at the root.[/quote]

Thats it! Now my grammar is working and the ASR recognize the input! Thank you!

There's something I'm still missing though... when I try to print the output value I get [Default Object] instead of the word I pronounced (eg. Roma)

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #6 on: June 19, 2019, 02:25:13 PM »
Read about output and shadow variables

Enviado de meu SM-G9650 usando o Tapatalk


Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #7 on: June 19, 2019, 03:22:13 PM »
Hi again,

it works now!

I was reading wrong the configuration for the Input Block in the example "HandleNBest" and in general the usage for the shadow variables. Instead of using AppState.[i]nameoftheblock[/i]$.utterance I was using AppState.[i]nameofthevariable[/i]$.utterance.

Thank you!

Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #8 on: June 19, 2019, 04:34:03 PM »
Is it possible to collect more words at once and store them in the same utterance (eg. Roma Genova Torino Milano) or do I have to go back in the Input block for every word I want to collect?

I tried to pronounce three cities at once (in order: Ancona, Bari, Roma) but I only got Bari stored in the variable

Thanks
« Last Edit: June 19, 2019, 04:35:51 PM by Sosy »

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #9 on: June 19, 2019, 04:36:13 PM »
Depends on your logic

Enviado de meu SM-G9650 usando o Tapatalk


Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #10 on: June 19, 2019, 04:58:25 PM »
For this application the Caller is asked to spell an alphanumeric code using city names in place of letters, so for example to get a code like [b]GG12345FT8960[/b] the Caller has to pronounce something like: [i]"Genova Genova 1 2 3 4 5 Firenze Torino 8 9 6 0"[/i]

Then, using a script, the code is stored in a variable.

Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #11 on: June 19, 2019, 05:01:38 PM »
Then your grammar must include numbers and the city names as letters. Then the input will have a length property.


Enviado de meu SM-G9650 usando o Tapatalk


Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #12 on: June 20, 2019, 11:12:33 AM »
The problem there was that all rules were written between <one-of></one-of> tags so once first word was captured all the other rules were ignored.

So using a WIP grxml file with only four rules (for letters A,B,C and D) I was able to detect all of them and stored all of them in the same variable at once.

However, this works only if I pronouce ALL of the letters...
If I pronounce only two of the letters the nomatch event is thrown.

I tried to use this code but it didnt work

[quote]<!-- the rule reference to LetterA can occur zero, one or many times -->

<item repeat="0-"> <ruleref uri="#LetterA"/> </item>[/quote]

Do you have any suggestion?

Thank you


Offline cavagnaro

  • Administrator
  • Hero Member
  • *****
  • Posts: 7641
  • Karma: 56330
Re: Nuance ASR Grammar on Composer
« Reply #13 on: June 20, 2019, 11:44:31 AM »
Don't understand what you are doing and why are you messing with the grxml directly.
Show your grammar designer at Composer screenshot.


Enviado de meu SM-G9650 usando o Tapatalk


Offline Sosy

  • Newbie
  • *
  • Posts: 44
  • Karma: 0
Re: Nuance ASR Grammar on Composer
« Reply #14 on: June 21, 2019, 10:29:32 AM »
Hi,

Here's my Grammar Builder view where i configured only 4 rules for testing.

[url=https://ibb.co/20zX2KZ][img]https://i.ibb.co/Ng0whYT/grammar-builder.jpg[/img][/url]

This gbuilder exports this .grxml

[quote]<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="it-IT" root="Codice" version="1.0" mode="voice">
    <rule id="Codice" scope="public">
        <one-of>
            <item>
                <tag>out='A'</tag>
                <one-of>
                    <item>
                        <token>A</token>
                    </item>
                    <item>
                        <token>Ancona</token>
                    </item>
                </one-of>
            </item>
            <item>
                <tag>out='B'</tag>
                <one-of>
                    <item>
                        <token>B</token>
                    </item>
                    <item>
                        <token>Bi</token>
                    </item>
                    <item>
                        <token>Bari</token>
                    </item>
                    <item>
                        <token>Bologna</token>
                    </item>
                </one-of>
            </item>
            <item>
                <tag>out='C'</tag>
                <one-of>
                    <item>
                        <token>C</token>
                    </item>
                    <item>
                        <token>Ci</token>
                    </item>
                    <item>
                        <token>Como</token>
                    </item>
                </one-of>
            </item>
            <item>
                <tag>out='D'</tag>
                <one-of>
                    <item>
                        <token>D</token>
                    </item>
                    <item>
                        <token>Di</token>
                    </item>
                    <item>
                        <token>Domodossola</token>
                    </item>
                </one-of>
            </item>
        </one-of>
    </rule>
</grammar>[/quote]

It works but, as I said, it accept only one input... and that's why I started to mess with .grxml directly. I came up with this solution:

[quote]<?xml version="1.0"?>
<grammar xmlns="http://www.w3.org/2001/06/grammar" xml:lang="it-IT" version="1.0" root="codice">


<rule id="A" scope="public">
<item repeat="0-5">
<one-of>
<item>Ancona</item>
<item>A</item>
</one-of>
</item>
</rule>



<rule id="B" scope="public">
<item repeat="0-5">
<one-of>
<item>Bologna</item>
<item>Bari</item>
<item>Bi</item>
<item>B</item>
</one-of>
</item>
</rule>



<rule id="C" scope="public">
<item repeat="0-5">
<one-of>
<item>Como</item>
<item>Ci</item>
<item>C</item>
</one-of>
</item>
</rule>



<rule id="D" scope="public">
<item repeat="0-5">
<one-of>
<item>Domodossola</item>
<item>Di</item>
<item>D</item>
</one-of>
</item>
</rule>




<!-- Reference by URI to a local rule -->
<rule id="codice" scope="public">
<item repeat="0-5">

<ruleref uri="#A" />
<ruleref uri="#B" />
<ruleref uri="#C" />
<ruleref uri="#D" />
</item>

</rule>


</grammar>[/quote]

It accept multiple input, no need to provide all inputs to work BUT it only accept inputs in order: if I pronounce "B, C" my variable is populated as AppState.Input = B C... on the other hand if I pronounce "C, B" my variable in only populated as AppState.Input = C. I cant figure out if there's a way to go back to a previous rule.