|
| Load grammar |
 |
Fri, 01 Jun 2007 09:04:14 -070 |
Hello,
I'm trying to make a speech recognition web service : a .wav file and
an SRGS grammar as input and the recognized sentence as output.
The grammar used is a near 200Ko , and the loading time is about 10 s
on my pc.
To reduce this time , I would load it in a DLL as explained at
http://msdn2.microsoft.com/en-us/library/system.speech.recognition.srgsgrammar.s
rgsgrammarcompiler.compileclasslibrary.aspx
and at
http://msdn2.microsoft.com/en-us/library/ms554237.aspx
I've compiled my grammar in "lib.DLL".
Then Grammar g = new Grammar("lib.DLL") gives out an Exception :
System.FormatException: lib.dll(1,1): error : Format de grammaire XML
non valide. Impossible de charger la grammaire dans le modèle d'objet
de document XML. ---> System.Xml.XmlException: Données non valides au
niveau racine. Ligne 1, position 1.
Can someone help me out please ?
|
| Post Reply
|
| Re: Load grammar |
 |
Mon, 4 Jun 2007 16:38:43 -0700 |
The grammar library is not meant to be used that way. It is like a normal
DLL that you can add as a reference to a managed project. For example, a
SampleGrammar.xml can be compiled as SampleGrammar class that inherits the
Grammar class. This class would be a file SampleGrammar.dll, and the
referencing projects can just instantiate objects of the class to be used
like a normal Grammar object.
I think you should compile the grammar into a CFG (either programmatically
with SrgsGrammarCompiler.Compile method, or with GC.exe shipped with the
Vista SDK). Then you can load the CFG with the method. The DLLs would
contain the CFG as a resource anyway, so there is no need to make a DLL for
your scenario.
<ssaidou@virtuoz.com> wrote in message
news:1180713854.702906.18160@q66g2000hsg.googlegroups.com...
Hello,
I'm trying to make a speech recognition web service : a .wav file and
an SRGS grammar as input and the recognized sentence as output.
The grammar used is a near 200Ko , and the loading time is about 10 s
on my pc.
To reduce this time , I would load it in a DLL as explained at
http://msdn2.microsoft.com/en-us/library/system.speech.recognition.srgsgrammar.s
rgsgrammarcompiler.compileclasslibrary.aspx
and at
http://msdn2.microsoft.com/en-us/library/ms554237.aspx
I've compiled my grammar in "lib.DLL".
Then Grammar g = new Grammar("lib.DLL") gives out an Exception :
System.FormatException: lib.dll(1,1): error : Format de grammaire XML
non valide. Impossible de charger la grammaire dans le modèle d'objet
de document XML. ---> System.Xml.XmlException: Données non valides au
niveau racine. Ligne 1, position 1.
Can someone help me out please ?
|
| Post Reply
|
| Re: Load grammar |
 |
Tue, 05 Jun 2007 06:26:26 -070 |
Hieu Nguyen,
Thanks for reply.
It works but loading an XML grammar or a CFG format grammar takes the
same time !!
Do you know any solution to make the grammar loading faster ??
|
| Post Reply
|
|
|
|
|
|
|
|
|
|