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 470159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:51:24+00:00 2026-05-12T23:51:24+00:00

I have a set of XML documents that all share the same schema. (They’re

  • 0

I have a set of XML documents that all share the same schema. (They’re SAPI grammars with semantic tags, if that matters.) I can use the documents to match text strings, returning a set of attributes with known values.

My problem is that I’d like to take a set of attribute values and generate a string from the grammar that (when submitted to the grammar) would produce the same set of attribute values. A further complication is that different grammars have the tags in different order (the grammars are for different natural languages), so I can’t do a straightforward tree walk.

Does anybody have a good approach to this problem?

EDIT: Here’s an example set of grammars:

Grammar 1 (English):

<GRAMMAR LANGID="409">
    <DEFINE>
    <ID NAME="NUMBERS1THROUGH8_ID" VAL="6503" />
    <ID NAME="NUMBERCOMMAND" VAL="-1"/>
    <ID NAME="NUMBER1" VAL="1"/>
    <ID NAME="NUMBER2" VAL="2"/>
    <ID NAME="NUMBER3" VAL="3"/>
    <ID NAME="NUMBER4" VAL="4"/>
    <ID NAME="NUMBER5" VAL="5"/>
    <ID NAME="NUMBER6" VAL="6"/>
    <ID NAME="NUMBER7" VAL="7"/>
    <ID NAME="NUMBER8" VAL="8"/>
    <ID NAME="NUMBER9" VAL="9"/>
    </DEFINE>

<RULE NAME="ChooseSynoynms">
   <L>
      <P>choose</P>
      <P>number</P>
      <P>select</P>
      <P>click</P>
   </L>
</RULE>

<RULE NAME="NumberList">
   <LN PROPNAME="numberCommand" PROPID="NUMBERCOMMAND">
     <PN VAL="NUMBER1">one</PN>
     <PN VAL="NUMBER2">two</PN>
     <PN VAL="NUMBER3">three</PN>
     <PN VAL="NUMBER4">four</PN>
     <PN VAL="NUMBER5">five</PN>
     <PN VAL="NUMBER6">six</PN>
     <PN VAL="NUMBER7">seven</PN>
     <PN VAL="NUMBER8">eight</PN>
     <PN VAL="NUMBER9">nine</PN>
   </LN>
</RULE>

<RULE ID="NUMBERS1THROUGH8_ID" TOPLEVEL="INACTIVE">
    <O %COMMAND_WEIGHT%><RULEREF NAME="ChooseSynoynms"/></O>
    <RULEREF NAME="NumberList" />
    <O>
        <P PROPNAME="ExplicitOK" VAL="1">ok</P>
    </O>
</RULE>
</GRAMMAR>

Grammar 2: (German)

<GRAMMAR LANGID="409">
    <DEFINE>
    <ID NAME="NUMBERS1THROUGH8_ID" VAL="6503" />
    <ID NAME="NUMBERCOMMAND" VAL="-1"/>
    <ID NAME="NUMBER1" VAL="1"/>
    <ID NAME="NUMBER2" VAL="2"/>
    <ID NAME="NUMBER3" VAL="3"/>
    <ID NAME="NUMBER4" VAL="4"/>
    <ID NAME="NUMBER5" VAL="5"/>
    <ID NAME="NUMBER6" VAL="6"/>
    <ID NAME="NUMBER7" VAL="7"/>
    <ID NAME="NUMBER8" VAL="8"/>
    <ID NAME="NUMBER9" VAL="9"/>
    </DEFINE>

<RULE NAME="ChooseSynoynms">
   <L>
      <P>wahlen</P>
      <P>Nummer</P>
      <P>auswahlen</P>
      <P>klicken</P>
   </L>
</RULE>

<RULE NAME="NumberList">
   <LN PROPNAME="numberCommand" PROPID="NUMBERCOMMAND">
     <PN VAL="NUMBER1">eins</PN>
     <PN VAL="NUMBER2">zwei</PN>
     <PN VAL="NUMBER3">drei</PN>
     <PN VAL="NUMBER4">vier</PN>
     <PN VAL="NUMBER5">funf</PN>
     <PN VAL="NUMBER6">sechs</PN>
     <PN VAL="NUMBER7">sieben</PN>
     <PN VAL="NUMBER8">acht</PN>
     <PN VAL="NUMBER9">neun</PN>

   </LN>
</RULE>

<RULE ID="NUMBERS1THROUGH8_ID" TOPLEVEL="INACTIVE">
      <P><O>auf</O></P> <RULEREF NAME="NumberList"/>
      <O>
        <P PROPNAME="ExplicitOK" VAL="1">OK</P>
      </O>
      <P><RULEREF NAME="ChooseSynoynms"/></P>
</RULE>
</GRAMMAR>

What I want to do is to specify “NumberCommand = 5” and get “choose 5” from the English grammar, and “funf klicken” from the German 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-12T23:51:25+00:00Added an answer on May 12, 2026 at 11:51 pm

    So what I’ve decided to do is to traverse the grammar rules directly (using the parsed form, not the XML) and use a set containing the semantic tags. When I reach a node containing semantic information, I select the node that matches the appropriate semantic tag (and remove the match from the set); otherwise, I make a transition at random. When I reach the end node, I verify that the set is empty; if not, it’s an error (I’ve generated a valid reco that doesn’t have all the required tags).

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

Sidebar

Related Questions

I have a large set of XML files of a propriatary schema -the XML
I have a number rather large, complex xml documents that I need to loop
I have an application that stores xml documents inside a column on SQL Server.
Is it possible to have a different set of dependencies in a maven pom.xml
Spring: In my context.xml, I have: <util:set id=someIDs set-class=java.util.HashSet value-type=java.lang.String> <value>W000000001</value> <value>W000000003</value> <value>W000000009</value> </util:set>
I have set up a Django application that uses images. I think I have
I was working on a bunch of XMLs that all share an attribute that
During development, I'd like to have an XML file in my iPhone app's Documents
We have set up a system where notifications get sent to a user with
I have set a canvas' background to an image of a company logo. I

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.