How to Use User Dictionary
This section explains how to activate words that have been saved to a profile using the Method for Pre-registration.
Usage Method
In addition to the speech recognition engine (grammarFileNames) in the request parameters for speech recognition, set the profile ID (profileId). The words registered in the profile will be active during that request session.
grammarFileNames={connection_engine_name} profileId=:{profile_id}
- For
profileId, specify the profile name preceded by a ":" (colon). - Profiles are distinguished by speech recognition engine, so set the
grammarFileNamesspecified during word registration in the request as well. - If registered from MyPage, set the Service ID as the profile ID. The service ID is the [Service ID] displayed in the Connection Information on the MyPage. For example, if the service ID is user01, specify
profileId=:user01.
For the WebSocket interface, specify it in the s command as follows. For details on audio formats, please see Audio Formats.
s {audio_format_name} {connection_engine_name} profileId=:{profile_id}
The system will work even without the ":" at the beginning of the profileId. However, for the following reasons, there is a possibility that the profile may be saved with unintended content, resulting in decreased recognition accuracy:
- If ":" is not added, the profile will be overwritten with the content used in that session when the speech recognition processing session ends.
- For example, if you update the content of the
testprofile separately using the user dictionary registration API while executing speech recognition processing using thetestprofile. In this case, when the speech recognition session ends, thetestprofile will be overwritten with the "content used in speech recognition processing" = "content before updating with the user dictionary registration API", resulting in a rollback.
If both profileId and profileWords are specified simultaneously, profileWords takes precedence. The words already registered in the profile will not be activated.
For example, if you make a request with the "会話_汎用" engine (-a-general), setting profileId to ":test" and profileWords to "AMI あみ" as follows, the words saved in the profile specified by profileId will not be activated in this session. Only "AMI あみ" set in profileWords will be active.
grammarFileNames=-a-general profileId=:test profileWords="AMI あみ"
Testing User Dictionary
Download the audio file (www.wav) and copy it to the directory where you will execute the command. It contains the recorded utterance "とりぷるだぶる". Run the sample with the following parameters:
- For
profileId, specify the profile ID with ":" (colon) added at the beginning. {API_KEY}is the [API Key] displayed on MyPage.
curl https://acp-api.amivoice.com/v1/recognize \
-F u={API_KEY} \
-F d="grammarFileNames=-a-general profileId=:{profile_id}" \
-F a=@www.wav
In the JavaScript version sample, you can confirm the effect of user dictionary with the following steps:
- Open WrpTester.html or wrp.html in a browser (except IE).
- In [プロファイル ID], enter the string with ":" (half-width colon) added at the beginning of the profile ID you want to use.
- In [APPKEY], enter the [API Key] from MyPage.
- Click the [録音の開始] button and say "とりぷるだぶる".
For instructions on how to run the JavaScript sample by obtaining an API key, please see here.