none
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"
             xmlns="http://www.w3.org/2001/06/grammar"
             xml:lang="en-US"
             tag-format="semantics/1.0"
             root="main"
             mode="voice">
    		 
    	<rule id="main">
    		<item><ruleref uri="#B" /><tag>out = rules.B</tag></item>
    	</rule>
    		 
    	<rule id="B">
    		<item><ruleref uri="#C" /><ruleref uri="#D" /><tag>out = rules.C + " " + rules.D</tag></item>
    	</rule>	 
    	
    	<rule id="D">
    	     <one-of>
    			<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>
    		</one-of>
    	</rule>
    	
    	<rule id="E">
    			<item><ruleref uri="#H" /><ruleref uri="#I" /><tag>out = rules.H + " " + rules.I</tag></item>
    	</rule>
    	
    	<rule id="F">
    			<item><ruleref uri="#G" /><ruleref uri="#D" /><tag>out = rules.G + " " + rules.D</tag></item>
    	</rule>
    		 
    	<rule id="C">
    			near
    			<tag>out = meta.current().text</tag>
    	</rule>		 
    	
    	<rule id="H">
    			the
    			<tag>out = meta.current().text</tag>
    	</rule>	
    
    	<rule id="I">
    		<one-of>
    			<item>kitchen</item>
    			<item>counter</item>
    		</one-of>
    		<tag>out = meta.current().text</tag>
    	</rule>		
    	
    	<rule id="G">
    			of
    			<tag>out = meta.current().text</tag>
    	</rule>	
    	
    </grammar>
    
    <!--
    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