WrpSimpleTester
This document explains how to run the sample program (WrpSimpleTester
) for the file speech recognition library Wrp
. WrpSimpleTester
operates on the console and can transcribe audio files into text.
- To run the program, you need to set your own
APPKEY
displayed on your My Page
- Please note that usage fees will be incurred according to the speech recognition used
Preparation
Obtain the source code following the How to Obtain instructions. Place it in any directory on your local machine.
Command Line Interface
Usage: WrpSimpleTester <url> <audioFileName> <codec> <grammarFileNames> [<authorization>]
Arguments
Argument | Description |
---|---|
url | Endpoint |
audioFileName | Audio file path |
codec | Codec |
grammarFileNames | Grammar file name |
authorization | APPKEY |
Execution Example
In each programming language directory, there are run.sh
or run.bat
files. By executing these, you can run the sample program with the following arguments:
Argument | Value | Description |
---|---|---|
url | wss://acp-api.amivoice.com/v1/ | WebSocket interface endpoint with logging |
audioFileName | ../../audio/test.wav | Audio file included with the sample program |
codec | 16K | Audio format |
grammarFileNames | -a-general | Connection engine name for 会話_汎用 engine |
authorization | APPKEY | Please specify the APPKEY displayed on your My Page |
Running the run
Script
For Windows
You can run by double-clicking the run.bat file located directly under each <programming language> folder, which will execute with that folder as the current directory. When executed, you will be prompted to enter the APPKEY.
When running from the terminal, please execute the following with Wrp/<programming language>
as the current directory:
run.bat
For Linux
When executing, please set Wrp/<programming language>
as the current directory.
chmod +x run.sh
./run.sh
Entering the APPKEY
When executed, you will be prompted to enter the APPKEY. Please enter the APPKEY
displayed on your My Page or obtain and enter a one-time APPKEY.
Please enter AppKey:
Execution Results
The processing of the run script for each programming language will be echoed and displayed. Below is an example for Python:
+ export PYTHONPATH=src
+ PYTHONPATH=src
+ export SSL_CERT_FILE=../../curl-ca-bundle.crt
+ SSL_CERT_FILE=../../curl-ca-bundle.crt
+ python WrpSimpleTester.py wss://acp-api.amivoice.com/v1/ ../../audio/test.wav 16K -a-general {APPKEY}
After waiting a few seconds, you will get results like the following, regardless of the programming language:
{"results":[{"tokens":[{"written":"\u30a2\u30c9\u30d0\u30f3\u30b9\u30c8\u30fb\u30e1\u30c7\u30a3\u30a2","confidence":1.00,"starttime":506,"endtime":1578,"spoken":"\u3042\u3069\u3070\u3093\u3059\u3068\u3081\u3067\u3043\u3042"},{"written":"\u306f","confidence":1.00,"starttime":1578,"endtime":1930,"spoken":"\u306f"},{"written":"\u3001","confidence":0.35,"starttime":1930,"endtime":2026,"spoken":"_"},{"written":"\u4eba","confidence":0.82,"starttime":2026,"endtime":2314,"spoken":"\u3072\u3068"},{"written":"\u3068","confidence":1.00,"starttime":2314,"endtime":2426,"spoken":"\u3068"},{"written":"\u6a5f\u68b0","confidence":1.00,"starttime":2426,"endtime":2826,"spoken":"\u304d\u304b\u3044"},{"written":"\u3068","confidence":1.00,"starttime":2826,"endtime":2938,"spoken":"\u3068"},{"written":"\u306e","confidence":0.97,"starttime":2938,"endtime":3082,"spoken":"\u306e"},{"written":"\u81ea\u7136","confidence":1.00,"starttime":3082,"endtime":3434,"spoken":"\u3057\u305c\u3093"},{"written":"\u306a","confidence":1.00,"starttime":3434,"endtime":3530,"spoken":"\u306a"},{"written":"\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3","confidence":1.00,"starttime":3530,"endtime":4362,"spoken":"\u3053\u307f\u3085\u306b\u3051\u30fc\u3057\u3087\u3093"},{"written":"\u3092","confidence":1.00,"starttime":4362,"endtime":4442,"spoken":"\u3092"},{"written":"\u5b9f\u73fe","confidence":1.00,"starttime":4442,"endtime":4922,"spoken":"\u3058\u3064\u3052\u3093"},{"written":"\u3057","confidence":1.00,"starttime":4922,"endtime":5306,"spoken":"\u3057"},{"written":"\u3001","confidence":0.63,"starttime":5306,"endtime":5626,"spoken":"_"},{"written":"\u8c4a\u304b","confidence":1.00,"starttime":5626,"endtime":5994,"spoken":"\u3086\u305f\u304b"},{"written":"\u306a","confidence":1.00,"starttime":5994,"endtime":6090,"spoken":"\u306a"},{"written":"\u672a\u6765","confidence":1.00,"starttime":6090,"endtime":6490,"spoken":"\u307f\u3089\u3044"},{"written":"\u3092","confidence":1.00,"starttime":6490,"endtime":6570,"spoken":"\u3092"},{"written":"\u5275\u9020","confidence":0.96,"starttime":6570,"endtime":7050,"spoken":"\u305d\u3046\u305e\u3046"},{"written":"\u3057\u3066","confidence":1.00,"starttime":7050,"endtime":7226,"spoken":"\u3057\u3066"},{"written":"\u3044\u304f","confidence":1.00,"starttime":7226,"endtime":7418,"spoken":"\u3044\u304f"},{"written":"\u3053\u3068","confidence":0.96,"starttime":7418,"endtime":7674,"spoken":"\u3053\u3068"},{"written":"\u3092","confidence":1.00,"starttime":7674,"endtime":7722,"spoken":"\u3092"},{"written":"\u76ee\u6307\u3057","confidence":0.78,"starttime":7722,"endtime":8090,"spoken":"\u3081\u3056\u3057"},{"written":"\u307e\u3059","confidence":0.79,"starttime":8090,"endtime":8538,"spoken":"\u307e\u3059"},{"written":"\u3002","confidence":0.94,"starttime":8538,"endtime":8746,"spoken":"_"}],"confidence":0.981,"starttime":250,"endtime":8746,"tags":[],"rulename":"","text":"\u30a2\u30c9\u30d0\u30f3\u30b9\u30c8\u30fb\u30e1\u30c7\u30a3\u30a2\u306f\u3001\u4eba\u3068\u6a5f\u68b0\u3068\u306e\u81ea\u7136\u306a\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u73fe\u3057\u3001\u8c4a\u304b\u306a\u672a\u6765\u3092\u5275\u9020\u3057\u3066\u3044\u304f\u3053\u3068\u3092\u76ee\u6307\u3057\u307e\u3059\u3002"}],"utteranceid":"20240720/10/0190cdba76010a30131294c4_20240720_102107","text":"\u30a2\u30c9\u30d0\u30f3\u30b9\u30c8\u30fb\u30e1\u30c7\u30a3\u30a2\u306f\u3001\u4eba\u3068\u6a5f\u68b0\u3068\u306e\u81ea\u7136\u306a\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u73fe\u3057\u3001\u8c4a\u304b\u306a\u672a\u6765\u3092\u5275\u9020\u3057\u3066\u3044\u304f\u3053\u3068\u3092\u76ee\u6307\u3057\u307e\u3059\u3002","code":"","message":""}
-> アドバンスト・メディアは、人と機械との自然なコミュニケーションを実現し、豊かな未来を創造していくことを目指します。
The first line is the raw response from the API in JSON format. After the "->" on the second line, the text result of the speech recognition from the text
field is displayed in color. For handling of results, please see Speech Recognition Result Format.