[asterisk-speech-rec] << Key-Pad to ASR grammar conversion >> CRM:00171138

Stephen Keller StephenKeller at LumenVox.com
Fri May 11 16:47:36 MST 2007


Jeff,

If you've purchased LumenVox, you already have a natural numbers grammar
built-in that should give you some ideas. But it was actually pretty
easy for me to just tweak it a bit to do what you want, so I've attached
a grammar that should cover everything you've asked for.

The one thing it can't do that you might need is accept input like
"twenty one two" for 212. You should be able to build that in easily
enough if it's needed.

If you don't have it already, you may want to grab our Speech Tuner
(it's included with the purchase of an Engine license, though it's a
separate download -- e-mail LumenVox support if you need the link) as it
includes a grammar editor that's handy for parsing these sorts of
things.

Also, check out our training videos, as they cover working with grammars
and semantic interpretation: http://www.lumenvox.com/support/videos/


Grammar:
 
#ABNF 1.0 UTF-8;
language en-US;
mode voice;
tag-format <lumenvox/1.0>;

root $request;

$request = {$="*"} $infotype {$ += $$} $threedigitstring {$ +=$$};

$infotype = facilities {$ = "20"} | emergency {$ = "30"} |
administration {$ = "40"}; 

$threedigitstring = {$ = ''} ($hundreds {$ += $$} | $ohbase {$+=$$}
$tens {$+=$$} | ($ohbase {$ += $$})<3>);

$base = one {$=1}	|
		two {$=2}	|
		three {$=3}	|
		four {$=4}	|
		five {$=5}	|
		six {$=6}	|
		seven {$=7}	|
		eight {$=8}	|
		nine {$=9}  ;
		
$teen = ten {$=10}	|
		eleven {$=11}	|
		twelve {$=12}	|
		thirteen {$=13}	|
		fourteen {$=14}	|
		fifteen {$=15}	|
		sixteen {$=16}	|
		seventeen {$=17}|
		eighteen {$=18}	|
		nineteen {$=19};
		
$twenty  = twenty  {$=20} (/0.9/ $base {$+=$$} | /0.1/
$NULL);//rationale for weights: 9 out of 10 times twenty is followed by
two or three or...
$thirty  = thirty  {$=30} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$forty   = forty   {$=40} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$fifty   = fifty   {$=50} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$sixty   = sixty   {$=60} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$seventy = seventy {$=70} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$eighty  = eighty  {$=80} (/0.9/ $base {$+=$$} | /0.1/ $NULL);
$ninety  = ninety  {$=90} (/0.9/ $base {$+=$$} | /0.1/ $NULL);

$tens = ($teen | $twenty | $thirty | $forty | $fifty | $sixty | $seventy
| $eighty | $ninety)	{$=$$};

$zero   = (oh|zero) {$=0};
$ohbase = (/0.1/ $zero| /0.9/ $base) {$=$$};
$and    = and|an;

$hundred  = (/0.05/[a] hundred {$=100}| /0.95/ $base hundred
{$=$$*100});
$hundreds = $hundred {$=$$} (/0.9/ [$and] ($tens | $base)
{$+=$$}|$NULL); 


Stephen Keller
LumenVox Support
P: 877-977-0707, just say "Support"
F: 858-707-7072
Support at LumenVox.com
www.LumenVox.com

Winner "Best Innovation in Speech Recognition"
AVIOS SpeechTEK Award

> -----Original Message-----
> From: asterisk-speech-rec-bounces at lists.digium.com 
> [mailto:asterisk-speech-rec-bounces at lists.digium.com] On 
> Behalf Of jeff quade
> Sent: Friday, May 11, 2007 3:28 AM
> To: asterisk-speech-rec at lists.digium.com
> Subject: [asterisk-speech-rec] << Key-Pad to ASR grammar conversion >>
> 
> Hello-
> Perhaps someone can save me a bit of time this weekend by 
> providing me with a sample grammar or some tips.
> 
> I have a client who has a campus of 30 buildings.
> Each building has a unique 3-digit building-ID-number in the 
> range of 100-900.
> Each building has specific Audio Data associated with it, ie:
> 1) Facilities Info
> 2) Emergency Info
> 3) Administrative Info
> 
> Currently to request Audio Data from our DB via Key-Pad 
> entry, a user enters a request in the following form:
> 
> Key-Pad Entry form:
> (Star)-(2 Digit Requested Data Code)-(3 Digit Building Number)
> 
> Examples:
> The following examples request Audio Data for building 110.
> For Facilities Info: *20110
> For Contact Info: *30110
> For Administration Info: *40110
> 
> So the object is to produce a grammar that would recognize 
> something like
> this:
> 
> Sample spoken form:
> (Requested Data Code Word)(Building Number)
> 
> Examples:
> The following examples request Audio Data from building 110.
> Example 1: "Facilities 110"
> Example 2: "Contact 110"
> Example 3: "Administration 110"
> 
> The grammar MUST recognize ALL 3-digit numbers, in the 
> following forms:
> 110 would be recognized from any of the following spoken word 
> sequences.
> one-hundred-ten
> one-one-zero
> one-one-oh
> one-hundred and ten
> 
> Semantic interpretation would return the Key-Pad equivalent 
> of the request so that the EXISTING Dial-Plan logic would NOT 
> need to be modified.
> 
> Examples:
> Example 1: "Facilities 110" would return "*20110"
> Example 2: "Contact 110" would return "*30110"
> Example 3: "Administration 110" would return "*40110"
> 
> I realize this is NOT a trivial exercise-I'm hoping someone 
> may have produced something similar so I have a place to 
> start. Thanks.
> 
> Suggestions or grammar-examples would be VERY HELPFUL.
> Existing "Bits and pieces" or grammar fragments would also be 
> helpful THANKS.
> 
> Cheers-
> JJQ
> 
> _________________________________________________________________
> More photos, more messages, more storage-get 2GB with Windows 
> Live Hotmail. 
> http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_
TAGHM_migration_HM_mini_2G_0507
> 
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
> 
> asterisk-speech-rec mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-speech-rec
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: request.gram
Type: application/octet-stream
Size: 1676 bytes
Desc: request.gram
Url : http://lists.digium.com/pipermail/asterisk-speech-rec/attachments/20070511/623f3368/request.obj


More information about the asterisk-speech-rec mailing list