How to Use Registered Words
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 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 word 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 word 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 Word Registration
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:
{Service ID}is the [Service ID] displayed in the connection information on MyPage. Add a ":" to the beginning. For example, if the service ID is user01, it should be :user01.{APP_KEY}is the [APPKEY] displayed on MyPage.
curl https://acp-api.amivoice.com/v1/recognize \
-F u={APP_KEY} \
-F d="grammarFileNames=-a-general profileId=:{Service ID}" \
-F a=@www.wav
In the JavaScript version sample, you can confirm the effect of word registration with the following steps:
- Open WrpTester.html or wrp.html in a browser (except IE).
- In [プロファイル ID], enter the string with ":" added to the beginning of the [Service ID] from MyPage.
- In [APPKEY], enter the [APPKEY] from MyPage.
- Click the [録音の開始] button and say "とりぷるだぶる".
For instructions on how to run the JavaScript sample by obtaining a one-time APPKEY, please see here.