diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/speechrecognition | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/ja/web/api/speechrecognition')
23 files changed, 2063 insertions, 0 deletions
diff --git a/files/ja/web/api/speechrecognition/abort/index.html b/files/ja/web/api/speechrecognition/abort/index.html new file mode 100644 index 0000000000..fd9348487e --- /dev/null +++ b/files/ja/web/api/speechrecognition/abort/index.html @@ -0,0 +1,105 @@ +--- +title: SpeechRecognition.abort() +slug: Web/API/SpeechRecognition/abort +tags: + - API + - Experimental + - Method + - Reference + - SpeechRecognition + - Web Speech API + - abort + - recognition + - speech +translation_of: Web/API/SpeechRecognition/abort +--- +<p>{{APIRef("Web Speech API")}}{{ SeeCompatTable() }}</p> + +<p><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a> の <code><strong>abort()</strong></code>メソッドは音声認識サービスが、入ってくる音声を聞くことを停止します。あと、{{domxref("SpeechRecognitionResult")}} を返しません。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.abort();</pre> + +<h3 id="Returns" name="Returns">返り値</h3> + +<p>Void型</p> + +<h3 id="Parameters" name="Parameters">パラメーター</h3> + +<p>無し</p> + +<h2 id="Examples" name="Examples">例</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; + +var diagnostic = document.querySelector('.output'); +var bg = document.querySelector('html'); + +document.body.onclick = function() { + recognition.start(); + console.log('色のコマンドを取得します'); +} + +abortBtn.onclick = function() { + recognition.abort(); + console.log('音声認識サービスを停止します'); +} + +recognition.onspeechend = function() { + recognition.stop(); + console.log('音声認識サービスが停止されました'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-abort', 'abort()')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.abort")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/audiostart_event/index.html b/files/ja/web/api/speechrecognition/audiostart_event/index.html new file mode 100644 index 0000000000..dc48b71745 --- /dev/null +++ b/files/ja/web/api/speechrecognition/audiostart_event/index.html @@ -0,0 +1,87 @@ +--- +title: 'SpeechRecognition: audiostart イベント' +slug: Web/API/SpeechRecognition/audiostart_event +tags: + - Event + - Reference + - SpeechRecognition + - Web Speech API + - audiostart + - onaudiostart + - イベント +translation_of: Web/API/SpeechRecognition/audiostart_event +--- +<div>{{APIRef("Web Speech API")}} {{SeeCompatTable}}</div> + +<div> +<p><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a> の <code><strong>audiostart</strong></code> イベントは、ユーザーエージェントが会話認識のためのオーディオキャプチャを開始したときに発生します。</p> +</div> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">バブリング</th> + <td>なし</td> + </tr> + <tr> + <th scope="row">キャンセル</th> + <td>不可</td> + </tr> + <tr> + <th scope="row">インターフェイス</th> + <td>{{domxref("Event")}}</td> + </tr> + <tr> + <th scope="row">イベントハンドラー</th> + <td>{{domxref("SpeechRecognition/onaudiostart", "onaudiostart")}}</td> + </tr> + </tbody> +</table> + +<h2 id="Examples" name="Examples">例</h2> + +<p><code>audiostart</code> イベントは、 {{domxref("SpeechRecognition/onaudiostart", "onaudiostart")}} メソッドの中で使用することができます。</p> + +<pre class="brush: js">var recognition = new webkitSpeechRecognition() || new SpeechRecognition(); + +recognition.addEventListener('audiostart', function() { + console.log('Audio capturing started'); +});</pre> + +<p>または、 <a href="/ja/docs/Web/API/SpeechRecognition/onaudiostart">onaudiostart</a> イベントハンドラープロパティを使用してください。</p> + +<pre class="brush: js">recognition.onaudiostart = function() { + console.log('Audio capturing started'); +}</pre> + +<h2 id="Specifications" name="Specifications">仕様書</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様書</th> + <th scope="col">状態</th> + <th scope="col">備考</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#speechreco-events', 'speech recognition events')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの対応</h2> + +<div> +<div class="hidden">このページの互換性一覧表は構造化データから生成されています。データに協力していただけるのであれば、 <a class="external" href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> をチェックアウトしてプルリクエストを送信してください。</div> + +<p>{{Compat("api.SpeechRecognition.audiostart_event")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> + <li>{{domxref("SpeechRecognition/onaudiostart", "onaudiostart")}} イベントハンドラープロパティ</li> +</ul> diff --git a/files/ja/web/api/speechrecognition/continuous/index.html b/files/ja/web/api/speechrecognition/continuous/index.html new file mode 100644 index 0000000000..a135333f7a --- /dev/null +++ b/files/ja/web/api/speechrecognition/continuous/index.html @@ -0,0 +1,101 @@ +--- +title: SpeechRecognition.continuous +slug: Web/API/SpeechRecognition/continuous +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - continuous + - recognition + - speech +translation_of: Web/API/SpeechRecognition/continuous +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>continuous</code></strong> プロパティは、認識が行われるたびに、継続的に結果を返すのか、あるいは1つの結果のみ返すのかを制御するようになります。</p> + +<p>既定では1つの結果です (<code>false</code>)</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myContinuous = mySpeechRecognition.continuous; +mySpeechRecognition.continuous = true; +</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>現在の <code>SpeechRecognition</code> の継続の状態を表す {{domxref("Boolean")}} 型。<code>true</code> の場合は継続的で、<code>false</code> の場合は1つのみの返しです。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> を参考しています</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'ja-JP'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<p>注意: 現在 <code>continuous</code> は Gecko で実装されておらず、いつも1つを返します。今のところ、継続的な返しをエミュレートするには、下記のソースコードのように何か返す結果が取れた時に、{{domxref("SpeechRecognition.start()")}} を実行します。</p> + +<pre class="brush: js">recognition.onresult = function(event) { + ... + recognition.start(); +}</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-continuous', 'continuous')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.continuous")}}</p> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> +</div> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/grammars/index.html b/files/ja/web/api/speechrecognition/grammars/index.html new file mode 100644 index 0000000000..0f53e1bf84 --- /dev/null +++ b/files/ja/web/api/speechrecognition/grammars/index.html @@ -0,0 +1,92 @@ +--- +title: SpeechRecognition.grammars +slug: Web/API/SpeechRecognition/grammars +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - grammars + - recognition + - speech +translation_of: Web/API/SpeechRecognition/grammars +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>grammars</code></strong> プロバティは現在の <code>SpeechRecognition</code> が理解できる文法を表す {{domxref("SpeechGrammar")}} オブジェクトの集合を返すことになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myGrammars = mySpeechRecognition.grammars; +mySpeechRecognition.grammars = mySpeechGrammarList; +</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>アプリの文法を表す{{domxref("SpeechGrammar")}} オブジェクトに含まれている {{domxref("SpeechGrammarList")}}</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> を参考しています</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'ja-JP'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-grammars', 'grammars')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.grammars")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/index.html b/files/ja/web/api/speechrecognition/index.html new file mode 100644 index 0000000000..eb362d03f0 --- /dev/null +++ b/files/ja/web/api/speechrecognition/index.html @@ -0,0 +1,163 @@ +--- +title: SpeechRecognition +slug: Web/API/SpeechRecognition +tags: + - API + - Experimental + - Interface + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - speech +translation_of: Web/API/SpeechRecognition +--- +<p>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</p> + +<p><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a> の <strong><code>SpeechRecognition</code></strong> インターフェイスは、認識サービスの制御インターフェイスです。これは、認識サービスから送信された {{domxref("SpeechRecognitionEvent")}} も扱います。</p> + +<div class="note"> +<p><strong>注記</strong>: Chrome では、ウェブページ上で音声認識を使用するとサーバーベースの認識エンジンが使用されます。あなたの音声を認識処理するためにウェブサービスへ送信するのでオフラインでは動作しません。</p> +</div> + +<h2 id="Constructor" name="Constructor">コンストラクター</h2> + +<dl> + <dt>{{domxref("SpeechRecognition.SpeechRecognition()")}}</dt> + <dd>新しい <code>SpeechRecognition</code> オブジェクトを作成します。</dd> +</dl> + +<h2 id="Properties" name="Properties">プロパティ</h2> + +<p><em><code>SpeechRecognition</code> は、親インターフェイスである {{domxref("EventTarget")}} からのプロパティも継承します。</em></p> + +<dl> + <dt>{{domxref("SpeechRecognition.grammars")}}</dt> + <dd>現在の <code>SpeechRecognition</code> により理解される文法を表す、{{domxref("SpeechGrammar")}} オブジェクトのコレクションを返して設定します。</dd> + <dt>{{domxref("SpeechRecognition.lang")}}</dt> + <dd>現在の <code>SpeechRecognition</code> の言語を返して設定します。指定されない場合、これはデフォルトで HTML {{htmlattrxref("lang","html")}} 属性の値になります。どちらも設定されていない場合、ユーザーエージェントの言語設定が使用されます。</dd> + <dt>{{domxref("SpeechRecognition.continuous")}}</dt> + <dd>各認識の継続的な結果を返すか、単一の認識結果だけを返すかを制御します。デフォルトは単一 (<code>false</code>) です。</dd> + <dt>{{domxref("SpeechRecognition.interimResults")}}</dt> + <dd>暫定的な結果を返すか (<code>true</code>)、そうでないか (<code>false</code>) を制御します。暫定的な結果は、最終的な結果ではありません (つまり、{{domxref("SpeechRecognitionResult.isFinal")}} プロパティの値は <code>false</code>)。</dd> + <dt>{{domxref("SpeechRecognition.maxAlternatives")}}</dt> + <dd>結果ごとに提供される {{domxref("SpeechRecognitionAlternative")}} の最大数を設定します。デフォルト値は 1 です。</dd> + <dt>{{domxref("SpeechRecognition.serviceURI")}}</dt> + <dd>実際の認識を扱うための現在の <code>SpeechRecognition</code> に使用される音声認識サービスの場所を指定します。デフォルトはユーザーエージェントのスピーチサービスです。</dd> +</dl> + +<h3 id="Event_handlers" name="Event_handlers">イベントハンドラー</h3> + +<dl> + <dt>{{domxref("SpeechRecognition.onaudiostart")}}</dt> + <dd>ユーザーエージェントが音声の捕捉を開始した時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onaudioend")}}</dt> + <dd>ユーザーエージェントが音声の捕捉を終了した時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onend")}}</dt> + <dd>音声認識サービスとの接続が切れた時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onerror")}}</dt> + <dd>音声認識でエラーが起こった時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onnomatch")}}</dt> + <dd>音声認識サービスが意味を認識できない最終結果を返した時に発火します。これは、ある程度の認識はされているが、信頼できるしきい値 ({{domxref("SpeechRecognitionAlternative.confidence","confidence")}}) に達していないことを意味します。</dd> + <dt>{{domxref("SpeechRecognition.onresult")}}</dt> + <dd>音声認識サービスが結果を返した時に発火します。単語またはフレーズの認識結果が有意であり、アプリと通信してその結果が渡されます。</dd> + <dt>{{domxref("SpeechRecognition.onsoundstart")}}</dt> + <dd>何らかの音が鳴った時 (認識可能な音声またはそうでない音が検知された時) に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onsoundend")}}</dt> + <dd>何らかの音が鳴り止んだ時 (認識可能な音声またはそうでない音が止んだことが検知された時) に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onspeechstart")}}</dt> + <dd>音声認識サービスにより音声として認識された音が検出された時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onspeechend")}}</dt> + <dd>音声認識サービスにより認識された音声の停止が検出された時に発火します。</dd> + <dt>{{domxref("SpeechRecognition.onstart")}}</dt> + <dd>音声認識サービスが、現在の <code>SpeechRecognition</code> に関連付けられた文法の認識が意図された入力音声のリスニングを開始した時に発火します。</dd> +</dl> + +<h2 id="Methods" name="Methods">メソッド</h2> + +<p><em><code>SpeechRecognition</code> は、その親インターフェイスである {{domxref("EventTarget")}} からのメソッドも継承します。</em></p> + +<dl> + <dt>{{domxref("SpeechRecognition.abort()")}}</dt> + <dd>音声認識サービスによる入力音声のリスニングを停止し、{{domxref("SpeechRecognitionResult")}} を返そうとしないようにします。</dd> + <dt>{{domxref("SpeechRecognition.start()")}}</dt> + <dd>音声認識サービスによる入力音声のリスニングを開始し、現在の <code>SpeechRecognition</code> に関連付けられた文法の認識を行います。</dd> + <dt>{{domxref("SpeechRecognition.stop()")}}</dt> + <dd>音声認識サービスによる入力音声のリスニングを停止し、その時点までに補足した音声を使用して {{domxref("SpeechRecognitionResult")}} を返そうとします。</dd> +</dl> + +<h2 id="Examples" name="Examples">例</h2> + +<p>私たちのシンプルな <a href="https://github.com/mdn/web-speech-api/tree/master/speech-color-changer">Speech color changer</a> の例では、{{domxref("SpeechRecognition.SpeechRecognition", "SpeechRecognition()")}} コンストラクターを使用して新しい <code>SpeechRecognition</code> オブジェクトのインスタンスを生成し、新しい {{domxref("SpeechGrammarList")}} を作成、それを {{domxref("SpeechRecognition.grammars")}} プロパティを使用して <code>SpeechRecognition</code> インスタンスにより認識される文法に設定します。</p> + +<p>他の値を定義した後、私たちは、それを設定して、クリックイベントの発生時 ({{domxref("SpeechRecognition.start()")}} 参照) に認識サービスを開始します。音声の認識に成功すると、{{domxref("SpeechRecognition.onresult")}} ハンドラーが発火し、イベントオブジェクトから発話された色を展開、そしてそれを {{htmlelement("html")}} 要素の背景色に設定します。</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'en-US'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +var diagnostic = document.querySelector('.output'); +var bg = document.querySelector('html'); + +document.body.onclick = function() { + recognition.start(); + console.log('Ready to receive a color command.'); +} + +recognition.onresult = function(event) { + var color = event.results[0][0].transcript; + diagnostic.textContent = 'Result received: ' + color; + bg.style.backgroundColor = color; +}</pre> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様書</th> + <th scope="col">策定状況</th> + <th scope="col">備考</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#speechreco-section', 'SpeechRecognition')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの実装状況</h2> + + + +<p>{{Compat("api.SpeechRecognition")}}</p> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の許可設定</h3> + +<p>アプリ内で音声認識を使用するには、以下の許可設定を <a href="/docs/Web/Apps/Build/Manifest">manifest</a> で指定する必要があります:</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>特権アプリも必要なため、以下も同様に含める必要があります:</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連項目</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/interimresults/index.html b/files/ja/web/api/speechrecognition/interimresults/index.html new file mode 100644 index 0000000000..ac7bd5b1d0 --- /dev/null +++ b/files/ja/web/api/speechrecognition/interimresults/index.html @@ -0,0 +1,93 @@ +--- +title: SpeechRecognition.interimResults +slug: Web/API/SpeechRecognition/interimResults +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - speech +translation_of: Web/API/SpeechRecognition/interimResults +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>interimResults</code></strong> プロパティは interim の結果を返す (<code>true</code>) か返さない (<code>false</code>) か制御します。Interim の結果は最終的ではない結果になります (例えば {{domxref("SpeechRecognitionResult.isFinal")}} プロパティは <code>false</code> となる)。</p> + +<p><strong><code>interimResults</code></strong> のデフォルト値は <code>false</code> です。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myInterimResult = mySpeechRecognition.interimResults; +mySpeechRecognition.interimResults = false; +</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>現在の <code>SpeechRecognition</code> の interim の結果を表す {{domxref("Boolean")}}。<code>true</code> の場合は interim の結果を返すことができ、<code>false</code> の場合は返すことができません。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> を参考しています</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'ja'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-interimresults', 'interimResults')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.interimResults")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">県連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/lang/index.html b/files/ja/web/api/speechrecognition/lang/index.html new file mode 100644 index 0000000000..b24fe61081 --- /dev/null +++ b/files/ja/web/api/speechrecognition/lang/index.html @@ -0,0 +1,92 @@ +--- +title: SpeechRecognition.lang +slug: Web/API/SpeechRecognition/lang +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - lang + - recognition + - speech +translation_of: Web/API/SpeechRecognition/lang +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>lang</code></strong> プロパティは現在の <code>SpeechRecognition</code> の言語を返します。指定されていない場合、HTML タグの {{htmlattrxref("lang","html")}} アトリビュートを返し、またそれも指定されていない場合、ユーザーエージェントの言語の設定を返します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myLang = mySpeechRecognition.lang; +mySpeechRecognition.lang = 'ja-JP'; +</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>現在の <code>SpeechRecognition</code> での BCP 47言語タグを表す {{domxref("DOMString")}}。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> を参考しています</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'ja-JP'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-lang', 'lang')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.lang")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/maxalternatives/index.html b/files/ja/web/api/speechrecognition/maxalternatives/index.html new file mode 100644 index 0000000000..2c4a5e10a1 --- /dev/null +++ b/files/ja/web/api/speechrecognition/maxalternatives/index.html @@ -0,0 +1,94 @@ +--- +title: SpeechRecognition.maxAlternatives +slug: Web/API/SpeechRecognition/maxAlternatives +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - maxAlternatives + - recognition + - speech +translation_of: Web/API/SpeechRecognition/maxAlternatives +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>maxAlternatives</code></strong> プロパティは {{domxref("SpeechRecognitionResult")}} で提供される {{domxref("SpeechRecognitionAlternative")}} の最大数を設定します。</p> + +<p>デフォルト値は <code>1</code> です</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myMaxAlternativeNumber = mySpeechRecognition.maxAlternatives; +mySpeechRecognition.maxAlternatives = 2; +</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>最大いくつ代替の結果を返すかを表す数</p> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> を参考しています</p> + +<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; +//recognition.continuous = false; +recognition.lang = 'ja-JP'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-maxalternatives', 'maxAlternatives')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.maxAlternatives")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onaudioend/index.html b/files/ja/web/api/speechrecognition/onaudioend/index.html new file mode 100644 index 0000000000..289528b00d --- /dev/null +++ b/files/ja/web/api/speechrecognition/onaudioend/index.html @@ -0,0 +1,80 @@ +--- +title: SpeechRecognition.onaudioend +slug: Web/API/SpeechRecognition/onaudioend +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onaudioend + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onaudioend +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onaudioend</code></strong> プロパティは、ユーザーエージェントが音声を取り込んだ後 ({{event("audioend")}}イベントが発生した時) に、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onaudioend = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.onaudioend = function() { + console.log('音声認識は終了しました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onaudioend', 'onaudioend')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onaudioend")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onaudiostart/index.html b/files/ja/web/api/speechrecognition/onaudiostart/index.html new file mode 100644 index 0000000000..acd1c87e05 --- /dev/null +++ b/files/ja/web/api/speechrecognition/onaudiostart/index.html @@ -0,0 +1,80 @@ +--- +title: SpeechRecognition.onaudiostart +slug: Web/API/SpeechRecognition/onaudiostart +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onaudiostart + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onaudiostart +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onaudiostart</code></strong> プロパティは、ユーザーエージェントが音声を取得し終えた時に ({{event("audiostart")}}イベントが発生した時) 、実行されるイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onaudiostart = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.onaudiostart = function() { + console.log('音声認識は開始しました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onaudiostart', 'onaudiostart')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onaudiostart")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onend/index.html b/files/ja/web/api/speechrecognition/onend/index.html new file mode 100644 index 0000000000..42e0c9092b --- /dev/null +++ b/files/ja/web/api/speechrecognition/onend/index.html @@ -0,0 +1,80 @@ +--- +title: SpeechRecognition.onend +slug: Web/API/SpeechRecognition/onend +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onend + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onend +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onend</code></strong> プロパティは、音声認識のサービスが切断された後 ({{event("end_(SpeechRecognition)","end")}}イベントが発生した時) に、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onend = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.onend = function() { + console.log('音声認識サービスが切断されました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onend', 'onend')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onend")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onerror/index.html b/files/ja/web/api/speechrecognition/onerror/index.html new file mode 100644 index 0000000000..24a3783215 --- /dev/null +++ b/files/ja/web/api/speechrecognition/onerror/index.html @@ -0,0 +1,80 @@ +--- +title: SpeechRecognition.onerror +slug: Web/API/SpeechRecognition/onerror +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onerror + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onerror +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onerror</code></strong> プロパティは、音声の認識でエラーが発生した場合(<a href="https://developer.mozilla.org/ja/docs/Web/Events/error_%28SpeechRecognitionError%29">error</a> イベントが発生した時) に、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onerror = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.onerror = function(event) { + console.log('音声を認識する際にエラーが発生しました:' + event.error); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onerror', 'onerror')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onerror")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onnomatch/index.html b/files/ja/web/api/speechrecognition/onnomatch/index.html new file mode 100644 index 0000000000..4994f0f5f8 --- /dev/null +++ b/files/ja/web/api/speechrecognition/onnomatch/index.html @@ -0,0 +1,86 @@ +--- +title: SpeechRecognition.onnomatch +slug: Web/API/SpeechRecognition/onnomatch +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onnomatch + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onnomatch +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onnomatch</code></strong> プロパティ、文法の辞書による音声認識サービスの最終結果として何も認識されていない場合 ({{event("nomatch")}}イベントが発生した時)、実行するイベントハンドラーになります。</p> + +<p>{{domxref("SpeechRecognitionAlternative.confidence","confidence")}}の<span class="text">閾値</span>を超えたり満たしたりしない程度の認識がされた場合も含まれます。</p> + +<div class="note"> +<p>注意:<code>onnomatch</code> ハンドラーは Firefox でまだ良く動作していませんので — 音声認識API は正規なマッチを返し、文法の辞書による項目を推測します。この不具合は今対応中です。</p> +</div> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onnomatch = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.onnomatch = function() { + console.log('音声は認識できませんでした。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onnomatch', 'onnomatch')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onnomatch")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加するのは必要になります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリも必要なので、下記の追加も必要になります。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onresult/index.html b/files/ja/web/api/speechrecognition/onresult/index.html new file mode 100644 index 0000000000..0a7cddc60f --- /dev/null +++ b/files/ja/web/api/speechrecognition/onresult/index.html @@ -0,0 +1,90 @@ +--- +title: SpeechRecognition.onresult +slug: Web/API/SpeechRecognition/onresult +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onresult + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onresult +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onresult</code></strong> プロパティは、音声認識サービスが結果を返した時に、つまり正しく言葉や文法が認識でき、アプリに通信した時 ({{event("result")}}イベントが発生した時) に、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onresult = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<p>下記のソースコードは <a class="external external-icon" href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> の例文から取り出しました。</p> + +<pre class="brush: js">recognition.onresult = function(event) { + // SpeechRecognitionEvent プロパティーは SpeechRecognitionResultList オブジェクトを返しました。 + // SpeechRecognitionResult オブジェクトは SpeechRecognitionResultList オブジェクトにあります。 + // ゲッターがあるので、配列のように呼び出すことができます。 + // 最初の[0]は 0 の位置にある SpeechRecognitionResult を返します。 + // それぞれの結果がある SpeechRecognitionAlternative オブジェクトは各位SpeechRecognitionResult オブジェクトにあります。 + // それもゲッターがあるので、配列のように呼び出すことができます。 + // 2つ目の[0]は 0 の位置にある SpeechRecognitionAlternative を返します。 + // SpeechRecognitionAlternative オブジェクトの transcript プロパティを返します。 + var color = event.results[0][0].transcript; + diagnostic.textContent = '結果:' + color + '.'; + bg.style.backgroundColor = color; +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onresult', 'onresult')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onresult")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onsoundend/index.html b/files/ja/web/api/speechrecognition/onsoundend/index.html new file mode 100644 index 0000000000..53d601fc6c --- /dev/null +++ b/files/ja/web/api/speechrecognition/onsoundend/index.html @@ -0,0 +1,78 @@ +--- +title: SpeechRecognition.onsoundend +slug: Web/API/SpeechRecognition/onsoundend +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onsoundend + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onsoundend +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>onsoundend</code></strong> プロパティは、何らかの音(認識できる音声、できない音声にかかわらず)が検出し終えた時に({{event("soundend")}} イベントが発生した時)、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onsoundend = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">recognition.onsoundend = function() { + console.log('音の検出は終わりました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onsoundend', 'onsoundend')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onsoundend")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onsoundstart/index.html b/files/ja/web/api/speechrecognition/onsoundstart/index.html new file mode 100644 index 0000000000..2305c53525 --- /dev/null +++ b/files/ja/web/api/speechrecognition/onsoundstart/index.html @@ -0,0 +1,78 @@ +--- +title: SpeechRecognition.onsoundstart +slug: Web/API/SpeechRecognition/onsoundstart +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onsoundstart + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onsoundstart +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onsoundstart</code></strong> プロパティは、何らかの音(認識できる音声、できない音声にかかわらず)が検出できた時に ({{event("soundstart")}}イベントが発生した時)、実行されるイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onsoundstart = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">recognition.onsoundstart = function() { + console.log('音が検出できました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onsoundstart', 'onsoundstart')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onsoundstart")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onspeechend/index.html b/files/ja/web/api/speechrecognition/onspeechend/index.html new file mode 100644 index 0000000000..a5c774f79e --- /dev/null +++ b/files/ja/web/api/speechrecognition/onspeechend/index.html @@ -0,0 +1,61 @@ +--- +title: SpeechRecognition.onspeechend +slug: Web/API/SpeechRecognition/onspeechend +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onspeechend + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onspeechend +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>onspeechend</code></strong> プロパティは、認識できる音声が検出し終えた時に (<code><a href="https://wiki.developer.mozilla.org/ja/docs/Web/API/SpeechRecognition/speechend_event">speechend</a></code> イベントが発生した時)、実行されるイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onspeechend = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">recognition.onspeechend = function() { + console.log('音声の検出が終わりました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onspeechend', 'onspeechend')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onspeechend")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onspeechstart/index.html b/files/ja/web/api/speechrecognition/onspeechstart/index.html new file mode 100644 index 0000000000..79ef5b1020 --- /dev/null +++ b/files/ja/web/api/speechrecognition/onspeechstart/index.html @@ -0,0 +1,61 @@ +--- +title: SpeechRecognition.onspeechstart +slug: Web/API/SpeechRecognition/onspeechstart +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onspeechstart + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onspeechstart +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>onspeechstart</code></strong> プロパティは、認識できる音声が検出できた時に(<code><a href="https://wiki.developer.mozilla.org/ja/docs/Web/API/SpeechRecognition/speechstart_event">speechstart</a></code> イベントが発生した時)、実行されるイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onspeechstart = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">recognition.onspeechstart = function() { + console.log('音声が検出できました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onspeechstart', 'onspeechstart')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onspeechstart")}}</p> +</div> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/onstart/index.html b/files/ja/web/api/speechrecognition/onstart/index.html new file mode 100644 index 0000000000..67f34f02ac --- /dev/null +++ b/files/ja/web/api/speechrecognition/onstart/index.html @@ -0,0 +1,78 @@ +--- +title: SpeechRecognition.onstart +slug: Web/API/SpeechRecognition/onstart +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - onstart + - recognition + - speech +translation_of: Web/API/SpeechRecognition/onstart +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}}インターフェイスの <strong><code>onstart</code></strong> プロパティは、現在の <code>SpeechRecognition</code> に関連する文法を認識する意図をもって、着信される音声を認識するサービスに接続された後 ({{event("start_(SpeechRecognition)","start")}}イベントが発生した時) に、実行するイベントハンドラーになります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.onstart = function() { ... }; +</pre> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">recognition.onstart = function() { + console.log('音声認識サービスに接続されました。'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-onstart', 'onstart')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.onstart")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/serviceuri/index.html b/files/ja/web/api/speechrecognition/serviceuri/index.html new file mode 100644 index 0000000000..c171bd7947 --- /dev/null +++ b/files/ja/web/api/speechrecognition/serviceuri/index.html @@ -0,0 +1,83 @@ +--- +title: SpeechRecognition.serviceURI +slug: Web/API/SpeechRecognition/serviceURI +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - serviceURI + - speech +translation_of: Web/API/SpeechRecognition/serviceURI +--- +<div>{{APIRef("Web Speech API")}}{{SeeCompatTable}}</div> + +<p>{{domxref("SpeechRecognition")}} インターフェイスの <strong><code>serviceURI</code></strong> プロパティは現在の <code>SpeechRecognition</code> が利用している音声認識の場所を指定しています。デフォルト値はユーザーの音声サービスです。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var myServiceURI = mySpeechRecognition.serviceURI; +mySpeechRecognition.serviceURI = 'path/to/my/service/';</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>音声認識サービスの URI を表す {{domxref("DOMString")}}。</p> + +<h2 id="Examples" name="Examples">例</h2> + +<pre class="brush: js">var recognition = new SpeechRecognition(); + +recognition.speechURI = 'http://www.example.com'; + +...</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-serviceuri', 'serviceURI')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.serviceURI")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/speechrecognition/index.html b/files/ja/web/api/speechrecognition/speechrecognition/index.html new file mode 100644 index 0000000000..0e9aa25fe3 --- /dev/null +++ b/files/ja/web/api/speechrecognition/speechrecognition/index.html @@ -0,0 +1,91 @@ +--- +title: SpeechRecognition() +slug: Web/API/SpeechRecognition/SpeechRecognition +tags: + - API + - Constructor + - Experimental + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - speech +translation_of: Web/API/SpeechRecognition/SpeechRecognition +--- +<p>{{APIRef("Web Speech API")}}{{ SeeCompatTable() }}</p> + +<p><strong>SpeechRecognition()</strong> は {{domxref("SpeechRecognition")}} オブジェクトインスタンスを作成します。</p> + +<h2 id="構文">構文</h2> + +<pre class="syntaxbox notranslate">var myRecognition = new SpeechRecognition();</pre> + +<h3 id="パラメータ">パラメータ</h3> + +<p>なし。</p> + +<h2 id="サンプル">サンプル</h2> + +<p>このコードは、<a href="https://github.com/mdn/web-speech-api/blob/master/speech-color-changer/script.js">Speech color changer</a> から引用しています。</p> + +<pre class="brush: js notranslate">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; +//recognition.continuous = false; +recognition.lang = 'en-US'; +recognition.interimResults = false; +recognition.maxAlternatives = 1; + +...</pre> + +<h2 id="仕様">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">策定状況</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dom-speechrecognition-speechrecognition', 'SpeechRecognition()')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="ブラウザ実装状況">ブラウザ実装状況</h2> + +<div> +<div> + + +<p>{{Compat("api.SpeechRecognition.SpeechRecognition")}}</p> +</div> +</div> + +<h3 id="Firefox_OS_permissions">Firefox OS permissions</h3> + +<p>speech recognition を使用するには、<a href="/docs/Web/Apps/Build/Manifest">manifest</a> に下記の permissions 設定が必要です:</p> + +<pre class="brush: json notranslate">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>特権を持ったアプリの場合は下記も設定して下さい:</p> + +<pre class="brush: json notranslate"> "type": "privileged"</pre> + +<h2 id="関連項目">関連項目</h2> + +<ul> + <li><a href="/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/start/index.html b/files/ja/web/api/speechrecognition/start/index.html new file mode 100644 index 0000000000..1a8d6291a4 --- /dev/null +++ b/files/ja/web/api/speechrecognition/start/index.html @@ -0,0 +1,105 @@ +--- +title: SpeechRecognition.start() +slug: Web/API/SpeechRecognition/start +tags: + - API + - Experimental + - Method + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - speech + - start +translation_of: Web/API/SpeechRecognition/start +--- +<p>{{APIRef("Web Speech API")}}{{ SeeCompatTable() }}</p> + +<p><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a> の <code><strong>start()</strong></code> メソッドは、{{domxref("SpeechRecognition")}} に関連する文法を認識する意図をもって、着信される音声を認識する音声認識サービスを開始します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.start();</pre> + +<h3 id="Parameters" name="Parameters">パラメーター</h3> + +<p>無し</p> + +<h3 id="Return_value" name="Return_value">返り値</h3> + +<p>Void型</p> + +<h2 id="Examples" name="Examples">例</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; + +var diagnostic = document.querySelector('.output'); +var bg = document.querySelector('html'); + +document.body.onclick = function() { + recognition.start(); + console.log('色のコマンドを取得します'); +} + +abortBtn.onclick = function() { + recognition.abort(); + console.log('音声認識サービスを停止します'); +} + +recognition.onspeechend = function() { + recognition.stop(); + console.log('音声認識サービスが停止されました'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-start', 'start()')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.start")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> diff --git a/files/ja/web/api/speechrecognition/stop/index.html b/files/ja/web/api/speechrecognition/stop/index.html new file mode 100644 index 0000000000..5e169b06d1 --- /dev/null +++ b/files/ja/web/api/speechrecognition/stop/index.html @@ -0,0 +1,105 @@ +--- +title: SpeechRecognition.stop() +slug: Web/API/SpeechRecognition/stop +tags: + - API + - Experimental + - Method + - Reference + - SpeechRecognition + - Web Speech API + - recognition + - speech + - stop +translation_of: Web/API/SpeechRecognition/stop +--- +<p>{{APIRef("Web Speech API")}}{{ SeeCompatTable() }}</p> + +<p><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a> の <code><strong>stop()</strong></code> メソッドは音声認識のサービスを停止し、入ってくる音声を聞かなくします。後、今まで認識した音声を {{domxref("SpeechRecognitionResult")}} として返します。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">mySpeechRecognition.stop();</pre> + +<h3 id="Returns" name="Returns">返り値</h3> + +<p>Void型</p> + +<h3 id="Parameters" name="Parameters">パラメーター</h3> + +<p>無し</p> + +<h2 id="Examples" name="Examples">例</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; + +var diagnostic = document.querySelector('.output'); +var bg = document.querySelector('html'); + +document.body.onclick = function() { + recognition.start(); + console.log('色のコマンドを取得します'); +} + +abortBtn.onclick = function() { + recognition.abort(); + console.log('音声認識サービスを停止します'); +} + +recognition.onspeechend = function() { + recognition.stop(); + console.log('音声認識サービスが停止されました'); +} +</pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + <tr> + <td>{{SpecName('Web Speech API', '#dfn-stop', 'stop()')}}</td> + <td>{{Spec2('Web Speech API')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザー実装状況</h2> + +<div> + + +<p>{{Compat("api.SpeechRecognition.stop")}}</p> +</div> + +<h3 id="Firefox_OS_permissions" name="Firefox_OS_permissions">Firefox OS の権限</h3> + +<p>アプリで音声認識を利用する前に、下記の権限を <a href="/ja/docs/Web/Apps/Build/Manifest">manifest</a> に追加する必要があります。</p> + +<pre class="brush: json">"permissions": { + "audio-capture" : { + "description" : "Audio capture" + }, + "speech-recognition" : { + "description" : "Speech recognition" + } +}</pre> + +<p>privileged アプリ権限も必要なので、下記も追加が必要です。</p> + +<pre class="brush: json"> "type": "privileged"</pre> + +<h2 id="See_also" name="See_also">関連情報</h2> + +<ul> + <li><a href="/ja/docs/Web/API/Web_Speech_API">Web Speech API</a></li> +</ul> |
