Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 816835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T01:53:58+00:00 2026-05-15T01:53:58+00:00

I to need create a programmatic equivalent using delphi language… or could someone post

  • 0

I to need create a programmatic equivalent using delphi language… or could someone post a link on how to do grammars in peech recogniton using the delphi. Or any examples of XML grammar that has programmatic equivalent in Delphi. sorry for my english.

**Programmatic Equivalent ** 

Ref: http://msdn.microsoft.com/en-us/library/ms723634(v=VS.85).aspx

        SPSTATEHANDLE hsHelloWorld;
        hr = cpRecoGrammar->GetRule(L"HelloWorld", NULL,
                        SPRAF_TopLevel | SPRAF_Active, TRUE,
                        &hsHelloWorld);
        hr = cpRecoGrammar->AddWordTransition(hsHelloWorld, NULL,
                L"hello world", L" ",
                SPWT_LEXICAL, NULL, NULL);
        hr = cpRecoGrammar->AddWordTransition(hsHelloWorld, NULL,
                L"hiya|there", L"|",
                SPWT_LEXICAL, NULL, NULL);
        hr = cpRecoGrammar->Commit(NULL);

XML Grammar Sample(s):

    <GRAMMAR>
        <!-- Create a simple "hello world" rule -->
        <RULE NAME="HelloWorld" TOPLEVEL="ACTIVE">
            <P>hello world</P>
        </RULE>
        <RULE NAME="HelloWorld_Disp" TOPLEVEL="ACTIVE">
            <P DISP="Hiya there!">hello world</P>
        </RULE>
        <RULE NAME="Question_Pron" TOPLEVEL="ACTIVE">
            <P DISP="I don't understand" PRON="eh">what</P>
        </RULE>
        <RULE NAME="NurseryRhyme" TOPLEVEL="ACTIVE">
            <P>hey</P>
            <P MIN="2" MAX="2">diddle</P>
        </RULE>
        <RULE NAME="UseWeights" TOPLEVEL="ACTIVE">
            <LIST>
                <P WEIGHT=".95">recognize speech</P>
                <P WEIGHT=".05">wreck a nice beach</P>
            </LIST>
        </RULE>
        <RULE NAME="UseProps" TOPLEVEL="ACTIVE">
            <P PROPNAME="NOVALUE">one</P>
            <P PROPNAME="NUMBER" VAL="2">two</P>
            <P PROPNAME="STRING" VALSTR="three">three</P>
        </RULE>
    </GRAMMAR>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T01:53:59+00:00Added an answer on May 15, 2026 at 1:53 am

    Guy’s I finally able to get the Answer ….
    This might be useful to others… 🙂

    this is the actual component that i created. just modify it for your needs.

    Function TSRRule.AddWord (Word : String; Value : string = ''; Separator : char = '|') : integer;
    var
      OleValue : OleVariant;
    begin
      result := 0;
      if Fwordlist.IndexOf(Word) = -1 then
         begin
           OleValue := Value;
           Fwordlist.Add(Word);
           FRule.InitialState.AddWordTransition(nil,  word, Separator, SPWT_LEXICAL, FRuleName+'_value',Fwordlist.Count, OleValue, 1.0);
           FWordCount := Fwordlist.Count;
           result := FWordCount;
         end;
    end;
    

    Calling function…

    FSpRunTimeGrammar := SpInProcRecoContext.CreateGrammar(2); // we assign  another grammr on index 2
    
       SrRule1 := TSRRule.Create(1,'Rule1',FSpRunTimeGrammar);
       with SrRule1 do
          begin
             AddWord('Maxtor');
             AddWord('Open NotePad','Notepad.exe');
             AddWord('Maxtor Dexter TrandPack','',' ');
             commit;
          end;
       SrRule2 := TSRRule.Create(2,'Rule2',FSpRunTimeGrammar);
       with SrRule1 do
          begin
             AddWord('the box');
             AddWord('WeLcOmE SaPi');
             AddWord('Halo World');
             commit;
          end;
       FSpRunTimeGrammar.CmdSetRuleState('Rule1',SGDSActive);
       FSpRunTimeGrammar.CmdSetRuleState('Rule2',SGDSActive);
    

    Please Leave comment for clarifications…. good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Need to create a custom DNS name server using C which will check against
I'm using Visual Studio 2008 and I need create a DataTable from a Excel
I need create three random links to other posts, in my post view function.
I need create a link to users/id/microposts where id is the user id. I
I'm using Asp.net and C#, I need create and UNDO feature for a webspace.
I need create custom dialog and put JPanel into it. Is it possible?
i need create an email list sending to many emails. what is best solution
I need create clone repository. but I do not know where can I get
I need create a document word with Java. And I ask, how can I
i need create a variable with parent subclass. Example: Parent Class <?php class parentClass

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.