Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Let me make sure I understand, you want a phrase to set apart commands to the system, like "butler" or "Siri". So, you'll say "Butler, turn on TV". You can build this into your grammar.</p> <p>Here is an example of a simple grammar that requires an opening phrase before it recognizes a command. It uses semantic results to help you understand what was said. In this case the user must say "Open" or "Please open" or "can you open"</p> <pre><code> private Grammar CreateTestGrammar() { // item Choices item = new Choices(); SemanticResultValue itemSRV; itemSRV = new SemanticResultValue("I E", "explorer"); item.Add(itemSRV); itemSRV = new SemanticResultValue("explorer", "explorer"); item.Add(itemSRV); itemSRV = new SemanticResultValue("firefox", "firefox"); item.Add(itemSRV); itemSRV = new SemanticResultValue("mozilla", "firefox"); item.Add(itemSRV); itemSRV = new SemanticResultValue("chrome", "chrome"); item.Add(itemSRV); itemSRV = new SemanticResultValue("google chrome", "chrome"); item.Add(itemSRV); SemanticResultKey itemSemKey = new SemanticResultKey("item", item); //build the permutations of choices... GrammarBuilder gb = new GrammarBuilder(); gb.Append(itemSemKey); //now build the complete pattern... GrammarBuilder itemRequest = new GrammarBuilder(); //pre-amble "[I'd like] a" itemRequest.Append(new Choices("Can you open", "Open", "Please open")); itemRequest.Append(gb); Grammar TestGrammar = new Grammar(itemRequest); return TestGrammar; } </code></pre> <p>You can then process the speech with something like:</p> <pre><code>RecognitionResult result = myRecognizer.Recognize(); </code></pre> <p>and check for semantic results like:</p> <pre><code>if(result.Semantics.ContainsKey("item")) { string s = (string)result.Semantics["item"].Value; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload