Posted: Thu Sep 07, 2006 7:31 am Post subject: [asterisk-speech-rec]Troubles with grammars
Please post the grammar which is failing to load.
The lang directory of the LumenVox distribution contains our built in
grammars. These may be useful as a reference. I will post two full
examples below. One is ABNF SRGS and the second is the same grammar but
in GRXML SRGS.
$Half = [([on] one | [and] [on] the other | and )] (half | side);
/*
* Using shortcut to assign a string to a rule
* $RULENAME = (some rule definition (may be partial) ):'This is a rule'
* is equal to
* $RULENAME = (rule definition (may be partial) ){$ = 'This is a rule'}
*/
$GreenPepper = ((green | bell) pepper) :'green pepper';
/*
* Here's fun part toppinglist is an array of topping.
* We initialize it at the beginning of $Toppings rule,
* then whenever we see a new $Topping, we push it into
* the array.
*/
$Toppings = {$.toppinglist = new Array} ($Topping
{$.toppinglist.push($$)} )<1-> [and $Topping{$.toppinglist.push($$)}];
/*
* Here we have an array of pizza,
* which is the whole order.
*/
$FullToppingGrammar = {$ = new Array} [$Filler] ($Toppings |
$HalfTopping){$.push($$)}[$Filler][$HalfTopping {$.push($$)}];
GRXML:
Its important that the file begins with the <? Characters otherwise it
will assume that the format is ABNF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
"http://www.w3.org/TR/speech-grammar/grammar.dtd">
<!--
This grammar is modified from a W3C Semantic Interpretation Draft
Committee example
<rule id="Filler">
<item repeat="0-1"> and </item>
<one-of>
<item> I want </item>
<item> "I'd like" </item>
<item> Give me </item>
</one-of>
</rule>
<rule id="Half">
<item repeat="0-1">
<one-of>
<item>
<item repeat="0-1"> on </item>
one
</item>
<item>
<item repeat="0-1"> and </item>
<item repeat="0-1"> on </item>
the other
</item>
<item> and </item>
</one-of>
</item>
<one-of>
<item> half </item>
<item> side </item>
</one-of>
</rule>
<rule id="GreenPepper">
<item>
<one-of>
<item> green </item>
<item> bell </item>
</one-of>
<item> pepper </item>
</item>
<tag>
$="green pepper";
</tag>
</rule>
I think the problem is elsewhere, as no matter which grammar is
installed in the directory (including the example grammars Lumnevox
provides), the same error message and failure occurs. Is it not possible
output in verbose mode, some indication of the cause of the error?
Perhaps the file/path/directory that it is trying to load?
Alan
-----Original Message-----
From: asterisk-speech-rec-bounces@lists.digium.com
[mailto:asterisk-speech-rec-bounces@lists.digium.com] On Behalf Of
Kenneth Shumard
Sent: 05 September 2006 16:46
To: Discussing of speech recognition in Asterisk
Subject: Re: [asterisk-speech-rec] Lumenvox
Some sort of validation is apparently done by the Lumenvox SRE before it
considers a grammar to be loaded. If lumenvox.conf properly points to a
grammar and it fails to load, that suggests that there is some problem
within the grammar itself. I'm not (yet!) an expert on the syntax of the
grammars, so I'm afraid I can't be of much help troubleshooting yours. I
believe the Lumenvox Tuner can load a grammar, so you might try that
utility to see if it helps.
~Kenny Shumard
Digium
----- Original Message -----
From: Kenneth Shumard <kenny@digium.com>
To: Discussing of speech recognition in Asterisk
<asterisk-speech-rec@lists.digium.com>
Sent: Saturday, September 2, 2006 9:06:09 PM GMT-0600
Subject: Re: [asterisk-speech-rec] Lumenvox
I will look through the available documentation to try to find out under
what conditions a grammar can fail to load. If the available docs don't
specify, I'll see if I can get that added in.
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum