AmiVoice® Robot SDK  0.9.10
認識結果終了イベントについて

1. イベント関数

void(VOICE_RECOGNIZER_API_CALL * VOICE_RECOGNIZER_COMPLETE)(const void * instance, const char * json);
認識結果終了イベント関数の型.

引数
instanceイベントが発生したインスタンス(IVoiceRecognizerのインスタンスの識別などに使用します)
json認識結果/エラーをjson形式で示します。

2. jsonフォーマット

body = [object]
body.statuscode = [string] 後述のステータスコード一覧を参照
body.message = [string] エラー発生時のエラー内容
body.text = [string] 音声認識結果文字列
body.results = [object] の配列 (要素数 1~)
body.results[n] = [object] 認識結果詳細情報(候補がある場合は複数件)
body.results[n].text = [string] 音声認識結果文字列
body.results[n].tokens = [object] の配列 (要素数 0~)
body.results[n].tokens[i] = [object] 認識結果テキストの形態素
body.results[n].tokens[i].written = [string] 認識結果テキストの形態素の表記
body.results[n].tokens[i].spoken = [string] 認識結果テキストの形態素のよみ
body.results[n].tokens[i].confidence = [string] 認識結果テキストの形態素の信頼度
body.results[n].tokens[i].starttime = [number] 認識結果テキストの形態素の開始時間(msec)
body.results[n].tokens[i].endtime = [number] 認識結果テキストの形態素の終了時間(msec)
body.results[n].confidence = [number] 信頼度(0~1の値。0:信頼度低 1:信頼度高い)
body.results[n].starttime = [number] 発話開始時間
body.results[n].endtime = [number] 発話終了時間
body.results[n].tags = [string] の配列 (要素数 0~)
body.results[n].tags[j] = [string] 未使用
body.results[n].rulename = [string] 音声認識辞書名
body.utteranceid = [string] サーバが発版する発話ID
body.reserved = [string] 未使用
※ 認識成功時は
body.statuscode == ""
body.message == ""
body.text != ""
※ 認識失敗時は
body.statuscode != ""
body.message != ""
body.text == ""
※ 以下等号の関係が常に成立する
body.text == body.results[0].text
body.results[n].starttime == body.results[m].starttime
body.results[n].endtime == body.results[m].endtime

以下は音声認識成功時のサンプルです

{
"results": [
{
"tokens": [
{
"written": "音声",
"confidence": 0.87,
"starttime": 110,
"endtime": 500,
"spoken": "おんせー"
},
{
"written": "認識",
"confidence": 0.86,
"starttime": 500,
"endtime": 880,
"spoken": "にんしき"
},
{
"written": "です",
"confidence": 0.74,
"starttime": 880,
"endtime": 1100,
"spoken": "です"
},
{
"written": "と",
"confidence": 0.74,
"starttime": 1100,
"endtime": 1280,
"spoken": "と"
}
],
"confidence": 0.899,
"starttime": 0,
"endtime": 1690,
"tags": [],
"rulename": "",
"text": "音声認識ですと"
}
],
"utteranceid": "20150731/1788752144-JvYOG9I",
"text": "音声認識ですと",
"statuscode": "0",
"message": ""
}

3. ステータスコード一覧

  • -100 Failed to open audio device.
  • -101 All audio data are 0.
  • -102 Failed to release audio device.
  • -103 Failed to gain control for audio device.
  • -104 Failed to record audio data from audio device.
  • -105 Audio recording has been stopped forcelly.
  • -200 Frequency bandwidth of audio data is not enough.
  • -300 Recognition results overall confidence value is below ConfidenceLevel.
  • -301 ASR server is busy.
  • -302 Grammar file is not loaded.
  • -303 Interruption request was occured on speech recognition.
  • -304 Timeout was occured on speech recognition.
  • -305 Fatal error was occured on speech recognition.
  • -306 Fatal error by local side was occured on speech recognition.
  • -400 ASR server is not found.
  • -401 Can't connect to ASR server.
  • -402 Manager server doesn't not return the information about an ASR server.
  • -403 Failed to validate the connection for ASR server.
  • -404 Cancelled to connect the ASR server.
  • -406 Data sending error.
  • -407 Data recieving error. ※IRecognizerBase::servicePasswordに誤った文字列を指定した場合にもこのステータスコードが返ります。
  • -408 Closed the session forcelly by ASR server.
  • -410 No responce from ASR server a constant time.
  • -600 License file is not found.
  • -601 Mandatory parameter s is invalid.
  • -603 EngineMode file is invalid.
  • -605 Use limit on the number of times is over.
  • -610 The registration number of words in the upper limit(1000 words) is over.
  • -611 The spoken character can't be used for the registration word [s].
  • -612 The registered word[s] is too long(20 characters).
  • -613 The registration number of words in the upper limit(10 words) is over.
  • -700 EngineMode file is not found.
  • -701 Can't create hotword grammar file.
  • -702 Can't load hotword grammar file.
  • -703 Invalid language model.
  • -710 Can't allocate audio buffer for ASR recognition.
  • -711 Can't find temporary audio file for ASR recognition.
  • -720 Call setup() method first, after instantiate.
  • -721 Don't call start() method before stop() or cancel() method.
  • -730 Can't save configuration file for IVoiceRecognizerBase.
  • -731 Can't load configuration file for IVoiceRecognizerBase.
  • -750 Silent interval is over 10 seconds.