4
현재 Webkit Speech Recognition에서 RnD를하고 있는데 응용 프로그램 별 문법 파일을 만들고 싶었습니다. W3C 정의에 따르면 다음 코드를 작성했습니다. 그러나 그것은 이러한 단어에 대한 인식에서 향상된 결과를 나타내는 것 같지 않습니다. 친절하게도이 문제에 대해 도움을 줄 수 있습니까?Web Speech API 문법은 개발자에게 노출됩니까?
var 인식 = new webkitSpeechRecognition(); recognition.grammars.addFromUri ("voice/api_grammar/weight.grxml");
문법 파일은 다음과 같은 간단한 파일입니다.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE grammar PUBLIC "-//W3C//DTD GRAMMAR 1.0//EN"
"http://www.w3.org/TR/speech-grammar/grammar.dtd">
<grammar version="1.0"
xmlns="http://www.w3.org/2001/06/grammar"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2001/06/grammar
http://www.w3.org/TR/speech-grammar/grammar.xsd"
xml:lang="en-US" mode="voice" root="sequence">
<meta name='description' content='Example using examples'/>
<meta name='in.1' content='sunny Yorktown Heights New York United States'/>
<meta name='out.1' content='$sequence[$repeat[$alternatives["sunny"]],$ruleref[$token["Yorktown Heights"]],$Token["New","York"],$TOKEN["United States"]]'/>
<rule id="ruleref">
<example>"Yorktown Heights"</example>
<ruleref uri="#token"/>
</rule>
<rule id="alternatives">
<example>sunny</example>
<example>cloudy</example>
<example>warm</example>
<example>cold</example>
<one-of>
<item> sunny </item>
<item> cloudy </item>
<item> warm </item>
<item> cold </item>
</one-of>
</rule>
<rule id="repeat">
<example></example> <!-- for count=0 -->
<example>warm</example>
<example>warm sunny cloudy</example>
<item repeat="0-3">
<ruleref uri="#alternatives"/>
</item>
</rule>
<rule id="sequence">
<example>
warm sunny cloudy "Yorktown Heights" New York "United States"
</example>
<example>
warm sunny cloudy Yorktown Heights New York United
States
</example>
<example> <!-- this example is actually wrong but that is legal -->
warm sunny cloudy "Yorktown Heights" New York "United States"
</example>
<ruleref uri="#repeat"/> <ruleref uri="#ruleref"/>
<ruleref uri="#Token"/> <ruleref uri="#TOKEN"/>
</rule>
</grammar>
누구든지 위의 질문과 관련하여 일부 지원을 제공 할 수 있습니까? 더 자세한 설명이 필요하면 확실히 할 수 있습니다. 감사. –
[HTML 5 음성 입력 API에서 문법을 사용할 수 있습니까?] (http://stackoverflow.com/questions/8683772/is-there-a-way-to-use-a-grammar) -with-the-html-5-speech-input-api) –