Community
cancel
Showing results for 
Search instead for 
Did you mean: 
GMenv1
Innovator
81 Views

BuildGrammarFromFile incorrect GID

Good morning;

I'm trying to load a Grammar file for voice rec but keep on getting the following error

BuildGrammarFromFile
Incorrect GID

In the code below I've tried setting different int value just for kicks but same result:
As to the grammar file name, does it have to be in a specific format (with or without extension) and where should you locate the file?

Thank you
Gregory

 

 bool SetGrammarFromFile(String GrammarFilename)
        {

            int grammar = 111; 

            pxcmStatus sts = sr.BuildGrammarFromFile(grammar, PXCMSpeechRecognition.GrammarFileType.GFT_JSGF, GrammarFilename);
            if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR)
            {
                form.PrintStatus("Grammar Compile Errors:");
                form.PrintStatus(sr.GetGrammarCompileErrors(grammar));
                return false;
            }

            sts = sr.SetGrammar(grammar);
            if (sts < pxcmStatus.PXCM_STATUS_NO_ERROR) return false;


            return true;
        }

0 Kudos
8 Replies
Xusheng_L_Intel
Employee
81 Views

You can find this usage in our SDK sample app @C:\Program Files (x86)\Intel\RSSDK\sample\DF_SpeechRecognition. Thanks!

0 Kudos
GMenv1
Innovator
81 Views

David,

The code comes from the example. Actually in the example, GrammarFileType.GFT_JSGF is not set to a JSGF

And the question about the GID and how it relates to the file/setup/declaration remains.


Thank you

Gregory


 

0 Kudos
81 Views

I can’t reproduce the error.  I used sample source code and suggested grammar file type PXCSpeechRecognition::GFT_JSGF. Grammar file was used from sample folder C:\Program Files (x86)\Intel\RSSDK\sample\DF_SpeechRecognition\examples\cncexample.jsgf.

grammarFile input argument is full path to the file including directories and extension.

Can you attach your grammar file to debug?

0 Kudos
GMenv1
Innovator
81 Views

Anastasia,

Here is the file as a cut and ^paste since (.jsgf) attachments are refused below.

 #JSGF V1.0;
// Inspired by and extending example in http://www.w3.org/TR/jsgf/
grammar cncexample;
public <cnccommand> = [ <start-polite> ] <command> ;
<start-polite> = ( please | would you | could you | kindly ) + ;
<command> = <operation> [ <determiner> ] <object> ;
<operation> = ( open | move | copy | delete | close ) {OPERATION} ;
<determiner> = ( a | an | the ) ;
<object> = ( file | window | menu | link | directory) {OBJECT} ;

There is "some" progress in that specifying the full path helps though the program then crashes:  Is there a minimum proc to run on ?  I am testing on a NUC and Windows 10 so should be ok

Thank you,

Gregory

0 Kudos
Edward_S_Intel1
Employee
81 Views

Hi Gregory,

I checked your grammar file in C# and C++ samples. Everything is OK: grammar file is built and speech is recognized. To understand the problem in more details we need to check your environment. Could you check, please:
1. does original sample work (with original grammar file) on your PC?
2. does your grammar file work in original sample on your PC ?

You can find original C# sample here: C:\Program Files (x86)\Intel\RSSDK\framework\CSharp\DF_SpeechRecognition.cs\DF_SpeechRecognition.cs_vs2010-15.sln?

0 Kudos
Neil_F_1
Beginner
81 Views

Did this ever get resolved? I'm seeing the identical error, including the need to specify GFT_JSGF instead of GFT_NONE contra the example. My code is practically identical to Gregory's, and the information supplied so far hasn't helped me resolve the problem. Many thanks.

0 Kudos
GMenv1
Innovator
81 Views

Neil,

this never really got resolved.  We could not get the files to work based on the sample.  We (by the way, we as  a team, not me myself and I!) ended up using a super basic file:

#JSGF V1.0;

grammar testgrammar;

public <query> = <query-what> ( <query-name> );

<query-what> = ( what | what's );
<query-name> = ( [ your ] name );

which seems to work but again as far as the sample goes we never managed to make it work.

 

Gregory

0 Kudos
Neil_F_1
Beginner
81 Views

Gregory M. wrote:

Neil,

this never really got resolved.  We could not get the files to work based on the sample.  We (by the way, we as  a team, not me myself and I!) ended up using a super basic file:

<example snipped>

Gregory

Gregory,

I think I may have just solved it -- the path name passed in needs to be of type "wchar" (literal L"pathname"), not char*. The examples show pxcCHAR type being used which, despite its name, is synonymous with wchar_t . BTW, thanks for your quick reply to my earlier post.

0 Kudos