SpeechToTextAddCustomWords Method (SpeechToTextSuccessCallbackBoolean, SpeechToTextFailCallback, String, Words, DictionaryString, Object) |
Adds one or more custom words to a custom language model.The service populates the words resource for a custom model with out-of-vocabulary(OOV) words found in each corpus added to the model.You can use this method to add additional words or to modify existing words in the words resource.Only the owner of a custom model can use this method to add or modify custom words associated with the model.Adding or modifying custom words does not affect the custom model until you train the model for the new data by using the POST /v1/customizations/{customization_id}/train method.
You add custom words by providing a Words object, which is an array of Word objects, one per word.You must use the object's word parameter to identify the word that is to be added. You can also provide one or both of the optional sounds_like and display_as fields for each word.
The sounds_like field provides an array of one or more pronunciations for the word. Use the parameter to specify how the word can be pronounced by users.Use the parameter for words that are difficult to pronounce, foreign words, acronyms, and so on.For example, you might specify that the word IEEE can sound like i triple e.You can specify a maximum of five sounds-like pronunciations for a word, and each pronunciation must adhere to the following rules:
Use English alphabetic characters: a-z and A-Z.
To pronounce a single letter, use the letter followed by a period, for example, N.C.A.A. for the word NCAA.
Use real or made-up words that are pronounceable in the native language, for example, shuchensnie for the word Sczcesny.
Substitute equivalent English letters for non-English letters, for example, s for ç or ny for ñ.
Substitute non-accented letters for accented letters, for example a for à or e for è.
Use the spelling of numbers, for example, seventy-five for 75.
You can include multiple words separated by spaces, but the service enforces a maximum of 40 total characters not including spaces.
The display_as field provides a different way of spelling the word in a transcript. Use the parameter when you want the word to appear different from its usual representation or from its spelling in corpora training data.For example, you might indicate that the word IBM(trademark) is to be displayed as IBM™.
If you add a custom word that already exists in the words resource for the custom model, the new definition overrides the existing data for the word.If the service encounters an error with the input data, it returns a failure code and does not add any of the words to the words resource.
The call returns an HTTP 201 response code if the input data is valid.It then asynchronously pre-processes the words to add them to the model's words resource. The time that it takes for the analysis to complete depends on the number of new words that you add but is generally faster than adding a corpus or training a model.
You can use the GET /v1/customizations/{ customization_id}/words or GET /v1/customizations/{customization_id}/words/{word_name} method to review the words that you add.Words with an invalid sounds_like field include an error field that describes the problem.You can use other words methods to correct errors, eliminate typos, and modify how words are pronounced as needed.
Note: This method is currently a beta release that is available for US English only.
Namespace:
IBM.Watson.DeveloperCloud.Services.SpeechToText.v1
Assembly:
unity-documentation (in unity-documentation.exe) Version: 1.0.0.0 (1.0.0.0)
Syntax public bool AddCustomWords(
SpeechToTextSuccessCallback<bool> successCallback,
SpeechToTextFailCallback failCallback,
string customizationID,
Words words,
Dictionary<string, Object> customData = null
)
Parameters
- successCallback
- Type: IBM.Watson.DeveloperCloud.Services.SpeechToText.v1SpeechToTextSuccessCallbackBoolean
The success callback. - failCallback
- Type: IBM.Watson.DeveloperCloud.Services.SpeechToText.v1SpeechToTextFailCallback
The fail callback. - customizationID
- Type: SystemString
The requested custom language model's identifier. - words
- Type: IBM.Watson.DeveloperCloud.Services.SpeechToText.v1Words
Custom words. - customData (Optional)
- Type: System.Collections.GenericDictionaryString, Object
Optional custom data
Return Value
Type:
Boolean[Missing <returns> documentation for "M:IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.SpeechToText.AddCustomWords(IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.SpeechToText.SuccessCallback{System.Boolean},IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.SpeechToText.FailCallback,System.String,IBM.Watson.DeveloperCloud.Services.SpeechToText.v1.Words,System.Collections.Generic.Dictionary{System.String,System.Object})"]
See Also