From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../api/speechrecognitionalternative/index.html | 93 +++++++++++++++++++++ .../transcript/index.html | 97 ++++++++++++++++++++++ 2 files changed, 190 insertions(+) create mode 100644 files/ja/web/api/speechrecognitionalternative/index.html create mode 100644 files/ja/web/api/speechrecognitionalternative/transcript/index.html (limited to 'files/ja/web/api/speechrecognitionalternative') diff --git a/files/ja/web/api/speechrecognitionalternative/index.html b/files/ja/web/api/speechrecognitionalternative/index.html new file mode 100644 index 0000000000..14421c1010 --- /dev/null +++ b/files/ja/web/api/speechrecognitionalternative/index.html @@ -0,0 +1,93 @@ +--- +title: SpeechRecognitionAlternative +slug: Web/API/SpeechRecognitionAlternative +tags: + - API + - Experimental + - Interface + - Reference + - SpeechRecognitionAlternative + - Web Speech API + - recognition + - speech +translation_of: Web/API/SpeechRecognitionAlternative +--- +

{{APIRef("Web Speech API")}}{{SeeCompatTable}}

+ +

Web Speech APISpeechRecognitionAlternative インターフェイスは、音声認識サービスにより認識されている一つの単語を表します。

+ +

プロパティ

+ +
+
{{domxref("SpeechRecognitionAlternative.transcript")}} {{readonlyinline}}
+
認識された単語の transcript を含む文字列を返します。
+
{{domxref("SpeechRecognitionAlternative.confidence")}} {{readonlyinline}}
+
音声認識システムの認識の正しさの信頼度を表す評価を数値で返します。
+
+ +

+ +

このコードは、私たちの Speech color changer の例から抜粋しました。

+ +
recognition.onresult = function(event) {
+  // The SpeechRecognitionEvent results property returns a SpeechRecognitionResultList object
+  // The SpeechRecognitionResultList object contains SpeechRecognitionResult objects.
+  // It has a getter so it can be accessed like an array
+  // The first [0] returns the SpeechRecognitionResult at position 0.
+  // Each SpeechRecognitionResult object contains SpeechRecognitionAlternative objects that contain individual results.
+  // These also have getters so they can be accessed like arrays.
+  // The second [0] returns the SpeechRecognitionAlternative at position 0.
+  // We then return the transcript property of the SpeechRecognitionAlternative object
+  var color = event.results[0][0].transcript;
+  diagnostic.textContent = 'Result received: ' + color + '.';
+  bg.style.backgroundColor = color;
+}
+ + +

仕様

+ + + + + + + + + + + + + + +
仕様書策定状況備考
{{SpecName('Web Speech API', '#speechreco-alternative', 'SpeechRecognitionAlternative')}}{{Spec2('Web Speech API')}}
+ +

ブラウザーの実装状況

+ +
+ + +

{{Compat("api.SpeechRecognitionAlternative")}}

+
+ +

Firefox OS の許可設定

+ +

アプリ内で音声認識を使用するには、manifest ファイルに次の許可設定を指定する必要があります:

+ +
"permissions": {
+  "audio-capture" : {
+    "description" : "Audio capture"
+  },
+  "speech-recognition" : {
+    "description" : "Speech recognition"
+  }
+}
+ +

特権アプリも必要なため、以下も同様に含める必要があります:

+ +
  "type": "privileged"
+ +

関連項目

+ + diff --git a/files/ja/web/api/speechrecognitionalternative/transcript/index.html b/files/ja/web/api/speechrecognitionalternative/transcript/index.html new file mode 100644 index 0000000000..6eb8c3d932 --- /dev/null +++ b/files/ja/web/api/speechrecognitionalternative/transcript/index.html @@ -0,0 +1,97 @@ +--- +title: SpeechRecognitionAlternative.transcript +slug: Web/API/SpeechRecognitionAlternative/transcript +tags: + - API + - Experimental + - Property + - Reference + - SpeechRecognitionAlternative + - Web Speech API + - recognition + - speech + - transcript +translation_of: Web/API/SpeechRecognitionAlternative/transcript +--- +

{{APIRef("Web Speech API")}}{{ SeeCompatTable() }}

+ +

{{domxref("SpeechRecognitionResult")}} インターフェースの transcript 読み取り専用プロパティは、認識したワードの記録を含む文字列を返します。

+ +

連続認識において、連続した {{domxref("SpeechRecognitionResult")}} の連結がセッションの適切な記録を生成するように、必要に応じて先頭または末尾の空白が含まれます。

+ +

構文

+ +
var myTranscript = speechRecognitionAlternativeInstance.transcript;
+ +

戻り値

+ +

{{domxref("DOMString")}}。

+ +

+ +

このコードは、Speech color changer から抜き出しています。

+ +
recognition.onresult = function(event) {
+  // The SpeechRecognitionEvent results property returns a SpeechRecognitionResultList object
+  // The SpeechRecognitionResultList object contains SpeechRecognitionResult objects.
+  // It has a getter so it can be accessed like an array
+  // The first [0] returns the SpeechRecognitionResult at position 0.
+  // Each SpeechRecognitionResult object contains SpeechRecognitionAlternative objects that contain individual results.
+  // These also have getters so they can be accessed like arrays.
+  // The second [0] returns the SpeechRecognitionAlternative at position 0.
+  // We then return the transcript property of the SpeechRecognitionAlternative object
+  var color = event.results[0][0].transcript;
+  diagnostic.textContent = 'Result received: ' + color + '.';
+  bg.style.backgroundColor = color;
+}
+ +

仕様

+ + + + + + + + + + + + + + +
仕様ステータスコメント
{{SpecName('Web Speech API', '#dfn-transcript', 'transcript')}}{{Spec2('Web Speech API')}} 
+ +

ブラウザー実装状況

+ + + +

{{Compat("api.SpeechRecognitionAlternative.transcript")}}

+ + + +

Firefox OS 許可

+ +

アプリで音声認識を使用するには、manifest で次の許可が必要です:

+ +
"permissions": {
+  "audio-capture" : {
+    "description" : "Audio capture"
+  },
+  "speech-recognition" : {
+    "description" : "Speech recognition"
+  }
+}
+ +

特権アプリも必要なため、次のものも含める必要があります。

+ +
  "type": "privileged"
+ +

関連項目

+ + -- cgit v1.2.3-54-g00ecf