0
我試圖從統一使用Windows 10語法識別器,但它沒有檢測到任何東西。統一語法識別器不工作
private GrammarRecognizer grammarRecognizer;
在啓動功能
我:
grammarRecognizer = new GrammarRecognizer(Application.streamingAssetsPath + "/SRGS/myGrammar.xml", ConfidenceLevel.Low);
grammarRecognizer.OnPhraseRecognized += grammarRecognizer_OnPhraseRecognized;
grammarRecognizer.Start();
我也有這個功能:
void grammarRecognizer_OnPhraseRecognized(PhraseRecognizedEventArgs args)
{
System.Action keywordAction;
Debug.Log("word said: " + args.text + " - conf: " + args.confidence);
if (args.confidence >= ConfidenceLevel.Medium)
Debug.Log("Confidence is low");
print(args.semanticMeanings);
}
,但先前的功能永遠不會被調用,因爲它從來沒有承認什麼。我有這樣的語法:
<grammar version="1.0" xml:lang="en-US" root="playCommands"
xmlns="http://www.w3.org/2001/06/grammar">
<rule id="playCommands">
<ruleref uri="#playAction" />
<item> the </item>
<ruleref uri="#fileWords" />
</rule>
<rule id="playAction">
<one-of>
<item> play </item>
<item> start </item>
<item> begin </item>
</one-of>
</rule>
<rule id="fileWords">
<one-of>
<item> song </item>
<item> tune </item>
<item> track </item>
<item> item </item>
</one-of>
</rule>
</grammar>