Subject: RE: [Speechsc] Managing big grammars

From: "Reifenrath, Klaus" <[email-masked]>
Date: Wed, 8 Jun 2005 08:28:05 -0400

I agree. 

BUT unfortunately there is no MRCPv2 interface to just compile a grammar. So
grammar compilation needs to be done with vendor specific tools or APIs.
We could add a new method (allowed only in idle state):
COMPILE-GRAMMAR
that requires the header field
Compiled-Grammar-URI
that specifies the location of the compiled grammar (like
Personal-Grammar-URI).
Is it too late to add this simple optional method?

Klaus

-----Original Message-----
From: Shanmugham, Saravanan [mailto:[email-masked]] 
Sent: Dienstag, 7. Juni 2005 21:09
To: Corby Anderson; [email-masked]
Subject: RE: [Speechsc] Managing big grammars

 Sorry for the late reply. The way I think this should be addressed is to
have support for compiled grammars as URI. All Large or Huge grammars are
going to be URI referenced and never embedded in a DEFINE grammar. 
This means that the URI could point to compiled grammar file.

Another way is to use the chache capability. When you access a grammar
through HTTP is to cache it. In general instead of caching of the XML
grammar you could decide to cache the compiled version instead. This would
mean that you might do an initial DEFINE-GRAMMAR to force a compile of the
grammar and future references to that grammar URI would hit the cache and
hence the compiled version.

Sarvi

     -----Original Message-----
     From: [email-masked] 
     [mailto:[email-masked]] On Behalf Of Corby Anderson
     Sent: Thursday, May 26, 2005 2:11 PM
     To: [email-masked]
     Subject: [Speechsc] Managing big grammars
     
     What are folks' thoughts on how we could manage big 
     grammars with MRCP?
     
     There are two usage cases that I'm interested in: a Large 
     Grammar that takes several seconds to compile, and a Jumbo 
     Grammar that takes many many minutes to compile.  A Large 
     Grammar might contain several hundred or thousand entries. 
      A Jumbo Grammar might contain hundreds of thousands of entries.
     
     For a Jumbo Grammar, there's no way that a user can wait 
     for a grammar to be uploaded and compiled via the 
     DEFINE-GRAMMAR or RECOGNIZE methods.  A grammar that large 
     needs to be pre-compiled so that the DEFINE-GRAMMAR or 
     RECOGNIZE method can simply load the grammar binary.
     
     For a Large Grammar, it might be okay to make one user 
     wait a few seconds for the grammar to compile -- but it 
     would be a big win if that compiled grammar were stored 
     with a known name so that /subsequent/ uses of the same 
     grammar don't have to pay the same compilation penalty.
     
     Our current speech recognition vendor's api provides 
     methods for checking for the existence of a dynamic 
     grammar, and for compiling a new grammar (named as the 
     client specifies). The api also provides a powerful and 
     flexible way to manage these stored grammars.  Is there 
     some MRCP-friendly way for dealing with these types of 
     grammars?  If not, then is one being considered?
     
     Corby Anderson
     Tellme Networks, Inc.

     _______________________________________________
     Speechsc mailing list
     [email-masked]
     https://www1.ietf.org/mailman/listinfo/speechsc

_______________________________________________
Speechsc mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/speechsc

_______________________________________________
Speechsc mailing list
[email-masked]
https://www1.ietf.org/mailman/listinfo/speechsc

---

From: "David R. Oran" <[email-masked]>
Date: Wed, 8 Jun 2005 08:40:44 -0400

> Is it too late to add this simple optional method?
I don't see why we need this given we have DEFINE_GRAMMAR. If we  
simply allow DEFINE_GRAMMAR to take compiled grammars as well as XML  
grammars as Sarvi suggested, isn't this adequate?

I also think Sarvi's caching idea is a good thing for implementations  
to do, and while it doesn't affect the protocol it might be worth  
pointing out this optimization in the spec.

By the way, for NLSML we could have a hack which allowed a compiled  
version of the grammar to be embedded in the XML, thus avoiding the  
need for alternate URI forms, questions about wire encoding, and  
having to invent yet another vendor-extension mechanism since I  
assume compiled grammars are implementation-specific.

Might be worth suggesting something like this for EMMA too...

Dave.

---

From: Corby Anderson <[email-masked]>
Date: Wed, 08 Jun 2005 13:38:09 -0700

One feature that I'd like a COMPILE-GRAMMAR method to provide is the 
ability to specify common back-end storage (like Sarvi mentioned) so 
that compiling a Large Grammar one time could make it available to other 
MRCP servers via the Compiled-Grammar-URI that Klaus suggested.  It 
would be especially useful to us if the *client* could specify the URI 
where the grammar should be stored.  This would permit clients to use 
grammar names that are meaningful to the client.  (The example for 
Personal-Grammar-URI seems like the grammar name is specified by the 
client, but it's worth spelling out.)

To round out the utility of a feature like this, we'd need some way to 
determine if a grammar had already been compiled.  Since we're talking 
about URIs, the client could just do a HEAD on the grammar to see if it 
exists -- but does the client always have access to back-end resources 
in this way?  If not, then a QUERY-GRAMMAR method which takes a 
Compiled-Grammar-URI header could provide this capability.

Corby Anderson
Tellme Networks, Inc.

---

From: Qiru Zhou <[email-masked]>
Date: Wed, 08 Jun 2005 17:17:20 -0400

I think the problem here is there is no standard for compiled grammar
format. This is a vendor implementation specific which is not inter-operable
across different vendors. I agree that pre-compiled large grammars
can improve system response and processing efficiency. But I don't
know if this should be the part of standard. Same for cache, it is
an implementation specific issue. Another practice on this issue is to pre
load and archive large grammar in recognizer (i.e., add ARCHIVE-GRAMMAR method).

-- Qiru

Corby Anderson wrote:
>> From: Shanmugham, Saravanan [mailto:[email-masked]] Sent: Dienstag, 
>> 7. Juni 2005 21:09
>> Grammar that takes several seconds to compile, and a Jumbo     Grammar 
>> that takes many many minutes to compile.  A Large     Grammar might 
>> contain several hundred or thousand entries.      A Jumbo Grammar 
>> might contain hundreds of thousands of entries.
>> for a grammar to be uploaded and compiled via the     DEFINE-GRAMMAR 
>> or RECOGNIZE methods.  A grammar that large     needs to be 
>> pre-compiled so that the DEFINE-GRAMMAR or     RECOGNIZE method can 
>> simply load the grammar binary.
>> wait a few seconds for the grammar to compile -- but it     would be a 
>> big win if that compiled grammar were stored     with a known name so 
>> that /subsequent/ uses of the same     grammar don't have to pay the 
>> same compilation penalty.
>> methods for checking for the existence of a dynamic     grammar, and 
>> for compiling a new grammar (named as the     client specifies). The 
>> api also provides a powerful and     flexible way to manage these 
>> stored grammars.  Is there     some MRCP-friendly way for dealing with 
>> these types of     grammars?  If not, then is one being considered?
>>         Corby Anderson
>>     Tellme Networks, Inc.