问题
I'm trying to combine both the result of a semantic and a dictation request in the semantic value of a SRGS document. For example, I would say "Search potato" and the output would be something like out="Search Potato" where Potato is a random word spoken by the user. I tought about using the garbage special rule, but it doesn't seem to work. So far that's what I have :
<rule id="rule1" scope="public">
<one-of>
<item xml:lang="en-us">Search</item>
<item>Cherche</item>
</one-of>
<tag>out.command="Search"</tag>
<tag>out.param1=<ruleref special="GARBAGE"/></tag>
<tag>out=out.command+out.param1;</tag>
I also saw that post : Free-form text with custom SRGS based Grammer where someone proposed the DICTATION tag. But the problem is that it doesn't seem to be SRGS compatible.
If it helps, i use tag-format="semantics/1.0"
回答1:
If you look at the W3C paper "Extending SRGS to Support More Powerful and Expressive Grammars" you can see that this standards group sees the need for just the scenario you are mentioning (see example 1.a) but it currently is not supported in the SRGS standard. Your question is how to do this with SRGS but there are probably ways to achieve the same results outside of SRGS dependent upon the ASR platform being used.
回答2:
I have also searched high and low for this, and have finally found the answer. I have used the following code and loaded it into System.Speech.Recognition.Grammar and it works perfectly.
<ruleref uri="grammar:dictation" type="application/srgs+xml"/>
Just add this ruleref as an item wherever you want to get the dictated text. You can pull out the dictated text into a semantic/tag by using this directly after the ruleref:
<tag>out.SpokenText=rules.latest();</tag>
来源:https://stackoverflow.com/questions/10988117/combine-free-form-dictation-and-semantic-in-a-srgs-grammar