How to avoid overwriting of the "out" value of the rules RRS feed

  • Question

  • Hi to all! I've another problem with the SRGS grammars and the SISR formalism.

    I know that in the <tag> field is possible to assign "semantic vaules" to the matched rules, but this mechanism tend to overwrite the values of two matched rules with the same name under the same father node. To explain better, i'll show a simple example. Consider a simple grammar like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <grammar version="1.0"
    	<rule id="main">
    		<item><ruleref uri="#B" /><tag>out = rules.B</tag></item>
    	<rule id="B">
    		<item><ruleref uri="#C" /><ruleref uri="#D" /><tag>out = rules.C + " " + rules.D</tag></item>
    	<rule id="D">
    			<item><ruleref uri="#E" /><ruleref uri="#F" /><tag>out = rules.E + " " + rules.F</tag></item>
    			<item><ruleref uri="#E" /><tag>out = rules.E</tag></item>
    	<rule id="E">
    			<item><ruleref uri="#H" /><ruleref uri="#I" /><tag>out = rules.H + " " + rules.I</tag></item>
    	<rule id="F">
    			<item><ruleref uri="#G" /><ruleref uri="#D" /><tag>out = rules.G + " " + rules.D</tag></item>
    	<rule id="C">
    			<tag>out = meta.current().text</tag>
    	<rule id="H">
    			<tag>out = meta.current().text</tag>
    	<rule id="I">
    		<tag>out = meta.current().text</tag>
    	<rule id="G">
    			<tag>out = meta.current().text</tag>
    main -> B
    B -> C D
    D -> E F 
    D -> E
    E -> H I
    F -> G D

    I reported in the comment the schematic productions of the non-terminal symbols. Then, this grammar recognizer the sentences:

    1) "near the counter of the kitchen"

    2) "near the kitchen of the counter"

    3) "near the counter of the counter"

    4) "near the kitchen of the kitchen"

    without problem, but, for the problem concerning the overwriting of the rule semantic value under the same father child, the semantic returned is always missing the first noun, so, for the relative sentence, the semantic is

    1) near of the kitchen

    2) near of the counter

    3) near of the counter

    4) near of the kitchen

    try yourself. Is possible to avoid this behavior? How?

    Thank you

    Thursday, May 31, 2012 2:40 PM