diff options
Diffstat (limited to 'files/pt-br/web/api/speechgrammar/index.html')
-rw-r--r-- | files/pt-br/web/api/speechgrammar/index.html | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/files/pt-br/web/api/speechgrammar/index.html b/files/pt-br/web/api/speechgrammar/index.html new file mode 100644 index 0000000000..c1a3aac1cf --- /dev/null +++ b/files/pt-br/web/api/speechgrammar/index.html @@ -0,0 +1,79 @@ +--- +title: SpeechGrammar +slug: Web/API/SpeechGrammar +tags: + - API + - Experimental + - Fala + - Interface + - Referencia + - SpeechGrammar + - Web Speech API + - reconhecimento +translation_of: Web/API/SpeechGrammar +--- +<p>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</p> + +<p>A interface <strong><code>SpeechGrammar</code></strong> da <a href="/en-US/docs/Web/API/Web_Speech_API">Web Speech API</a> representa um conjunto de palavras ou padrões de palavras, os quais, nós queremos que o serviço de reconhecimento reconheça.</p> + +<p>A gramática é definida usando <a class="external external-icon" href="http://www.w3.org/TR/jsgf/">JSpeech Grammar Format</a> (<strong>JSGF</strong>.) Outros formatos podem ser suportados no futuro.</p> + +<h2 id="Construtor">Construtor</h2> + +<dl> + <dt>{{domxref("SpeechGrammar.SpeechGrammar()")}}</dt> + <dd>Cria um novo objeto <code>SpeechGrammar</code>.</dd> +</dl> + +<h2 id="Propriedades">Propriedades</h2> + +<dl> + <dt>{{domxref("SpeechGrammar.src")}}</dt> + <dd>Define e retorna a string contendo a gramática contida na instância do objeto <code>SpeechGrammar</code>.</dd> + <dt>{{domxref("SpeechGrammar.weight")}} {{optional_inline}}</dt> + <dd>Define e retorna o peso do objeto <code>SpeechGrammar</code>.</dd> +</dl> + +<h2 id="Exemplos">Exemplos</h2> + +<pre class="brush: js">var grammar = '#JSGF V1.0; grammar colors; public <color> = aqua | azure | beige | bisque | black | blue | brown | chocolate | coral | crimson | cyan | fuchsia | ghostwhite | gold | goldenrod | gray | green | indigo | ivory | khaki | lavender | lime | linen | magenta | maroon | moccasin | navy | olive | orange | orchid | peru | pink | plum | purple | red | salmon | sienna | silver | snow | tan | teal | thistle | tomato | turquoise | violet | white | yellow ;' +var recognition = new SpeechRecognition(); +var speechRecognitionList = new SpeechGrammarList(); +speechRecognitionList.addFromString(grammar, 1); +recognition.grammars = speechRecognitionList; + + +console.log(speechRecognitionList[0].src); // deveria retornar o mesmo conteúdo da variável grammar +console.log(speechRecognitionList[0].weight); // deveria retornar 1 - o mesmo peso definido na linha 4. +</pre> + +<h2 id="Especificações">Especificações</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#speechreco-speechgrammar', 'SpeechGrammar')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Compatibilidade_com_os_navegadores">Compatibilidade com os navegadores</h2> + +<div> + + +<p>{{Compat("api.SpeechGrammar")}}</p> +</div> + +<h2 id="Veja_também">Veja também</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> |