Documentations

ASR custom language model

Service: asr.api.yating.tw/v1/
The Yating ASR service offers a customization interface that you can use to augment its speech recognition capabilities. You can use customization to improve the accuracy of speech recognition requests by customizing a base model for your domain and audio.
The language model customization interface can improve the accuracy of speech recognition for domains such as medicine, law, information technology, and others. By using language model customization, you can expand and tailor the vocabulary of a base model to include domain-specific terminology.
You create a custom language model and add paragraphs, corpora and words specific to your domain. Once you train the custom language model on your enhanced vocabulary, you can use it for customized speech recognition. The service can typically train any custom model in a matter of minutes. The time and effort that are needed to create a custom model depend on the data that you have available for the model.
After creating a language model, you can use this model when doing streaming or batching asr services.

Create a customized Language mode

A corpus is a plain text document that uses terminology from the domain in context. You can generate a customized language model by giving a txt corpus file url. After a few minutes, you should be able to get a customized language model ID.
After you create your custom model, you can use it with speech recognition requests. If the audio that is passed for transcription contains domain-specific words that are defined in the custom model's corpora and custom words, the results of the request reflect the model's enhanced vocabulary. You can use only one model at a time with a speech recognition request and this model can only be used by the user who generated it.
There are 2 kinds of training data, text and words. You should put paragraph text and sentences in a text file, and put phrases and words in a word file. Properly format it and save it in one or more text files. Make sure total files’ size under 5 MB and each text file:
Is in plain text (it's not a file such as a Microsoft Word document, comma-separated value file, or PDF).
Is encoded in UTF-8.
Doesn't contain any formatting characters, such as HTML tags.
Is less than 1MB in size if you intend to use the file as training data. Amazon Transcribe only accepts a maximum of 1MB of training data.
Request
URL: /models/languages
Method: POST
Body
Name
Type
Info
*textUrls
string[]
Txt file urls.
您提供的文本以換行符號作為切分點,適合用來存放期待辨識出的句子,將每個句子作為高頻出現的常用語,紀錄在model內,當出現時能加以識別
*wordUrls
string[]
word file urls.
您提供的文本以空白符號及換行符號作為切分點,適合用來存放期待辨識出的單字,將每個單字作為高頻出現的常用語,紀錄在model內,當出現時能加以識別
*model
string
Only  asr-zh-en-std

** This custom language model is only compatible with the model you put in here.
*description
string
自定義的附註,幫助您紀錄儲存此客製化模型的相關資訊。
{
   "textUrls": [
       "Your_txt_file_url"
   ],
   "wordUrls": [
   ],
   "model": "asr-zh-en-std"
   "description": "description"
}
Response
{
   "uid": "uid",
   "model": "asr-zh-en-std",
   "description": "description",
   "textUrls": "Your_txt_file_url",
   "wordUrls": "",
   "path": "",
   "taskId": "",
   "status": "pending",
   "createdAt": "2022-11-16T10:35:12.296Z",
   "updatedAt": "2022-11-16T10:42:54.000Z"
}

Get models status

Request
URL: /models/languages?page=1&perPage=10&status=pending
Method: GET
Response
{
   "page":1,
   "perPage":10,
   "total":2,
   "nextPage":null,
   "data":[
      {
         "uid":"uid",
         "model":"asr-zh-en-std",
         "description":"description",
         "textUrls":"Your_txt_file_url",
         "wordUrls":"",
         "path":"",
         "taskId":"",
         "status":"completed",
         "createdAt":"2022-11-16T10:35:12.296Z",
         "updatedAt":"2022-11-16T10:42:54.000Z"
      }
   ]
}

Get a model status

Request
URL: /v1/models/languages/{uid}
Method: GET
Header
Name
Type
Info
Authorization
String
Bearer {key}
Query parameter
Name
Info
uid
string, uid.
Response
{
   "uid":"uid",
   "model":"asr-zh-en-std",
   "description":"description",
   "textUrls":"Your_txt_file_url",
   "wordUrls":"",
   "path":"",
   "taskId":"",
   "status":"completed",
   "createdAt":"2022-11-16T10:35:12.296Z",
   "updatedAt":"2022-11-16T10:42:54.000Z"
}

Delete a custom LM

Request
URL: /models/languages/{id}
Method: DELETE
Response
If you succeed, you’ll see.
{
   "statusCode": 400,
   "message": "Language Model Not Found"
}