Subject: RE: [Speechsc] Managing big grammars

From: "Shanmugham, Saravanan" <[email-masked]>
Date: Thu, 9 Jun 2005 14:16:48 -0700

I agree, the issue is that there is no standard for compilation and
compiled grammar format.  I am not sure a COMPILE-GRAMMAR method is the
solution to this. 

The aim of compilation is to accelarate customer response when dealing
with large-grammars.
A few ways to achieve the above, like I mentioned earlier are,
   1. The MRCP server could implement an optimization for large grammars
that leverages the grammar caching mechanism and its capabilities. That
is when they cache a grammar URI, they also store the compiled version
of the grammar. They could do this in a vendor specific compiled format.
Large grammars are usually not dynamic and hence the caching mechanims
should work reasonably well for this.
   2. Have the MRCP client point to pre-compiled-grammars so that when
the MRCP server goes and fetches it the large-grammar is already
compiled. There is the problem of making sure the compiled
grammar(vendor-specific) matches the specific recognition engine used.
This is difficult to manage in a multivendor deployment.
   3. Compile and store the grammars on the MRCP server ahead of time
during deployments. And then refer to these compiled grammars on the
MRCP server. This would have its own limitations, but would be workable
in many cases/deployments.

We could add the text for the first above bullet into the MRCPv2
specification if no one has any objects to it.

Thanks,

     -----Original Message-----
     From: [email-masked] 
     [mailto:[email-masked]] On Behalf Of Qiru Zhou
     Sent: Wednesday, June 08, 2005 2:17 PM
     To: Corby Anderson
     Cc: [email-masked]
     Subject: Re: [Speechsc] Managing big grammars
     
     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:
     > 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.
     > 
     > 
     > Reifenrath, Klaus wrote:
     > 
     >> 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

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

---

From: Corby Anderson <[email-masked]>
Date: Fri, 10 Jun 2005 11:51:35 -0700

Option #1 seems like a step in the right direction, but having 
multi-server re-use would make it even more useful. Option #1 as worded 
implies that /each /MRCP server would have to compile grammar "X" the 
first time it's used;  I'm suggesting that we try and make one MRCP 
server's compilation efforts useful to other MRCP servers (as long as 
they're the same vendor).  The use case I have in mind is a "farm" of 
recognition servers -- and when we compile one of these Large grammars 
(grammar "X"), it would be great to store it in some common storage area 
so that other MRCP servers could check for its existence and load the 
binary. 
It isn't necessary to have a standard compiled grammar format -- it's 
just necessary to have a standard way to reference them.  In a server 
farm environment containing multiple vendors' MRCP servers, wouldn't the 
client know (or couldn't it discover during session setup) which kind of 
server it was connecting to and so adjust the query/compile uri 
accordingly?  I envision something along the lines of:

    MRCP/2.0 82 QUERY-GRAMMAR 123456
    Compiled-Grammar-URI:
    http://grammar-resource/<insert_vendor_here>/query?name=<grammar_name>

    MRCP/2.0 507 COMPILE-GRAMMAR 123654
    Compiled-Grammar-URI:
    http://grammar-resource/<insert_vendor_here>/store?name=<grammar_name>
    Content-type: application/srgs+xml
    Content-Length: 176

    <?xml version="1.0" (etc.)

Where the "grammar-resource" would be simple and general enough to be 
implemented by either the client or the vendor.

Corby Anderson
Tellme Networks, Inc.