QuerySpeechLanguageModel

The QuerySpeechLanguageModel action takes one or more words and returns whether those words are present in the vocabulary (produced from a combination of a base language pack and an optional custom language model).

If a word is not present in the vocabulary then it is never returned during speech-to-text, and you might be able to improve accuracy by training a custom language model.

Type: synchronous

Parameter Description Required
CustomLanguageModel The name and interpolation weight of a custom language model to use to supplement the base language pack. Separate the name and interpolation weight with a colon (:). No
LanguagePack The base language pack. Yes
Words A comma-separated list of words to test. Yes

Example

The following example checks whether the words magnetic, resonance, and imaging are in the vocabulary when you use the ENUS language pack and a custom language model named MedicalTerms with an interpolation weight of 0.1.

/action=QuerySpeechLanguageModel&LanguagePack=ENUS
                                &CustomLanguageModel=MedicalTerms:0.1
                                &Words=magnetic,resonance,imaging

Response

The following XML is an example response.

<autnresponse>
  <action>QUERYSPEECHLANGUAGEMODEL</action>
  <response>SUCCESS</response>
  <responsedata>
    <queryWord>
      <word>magnetic</word>
      <exists>True</exists>
      <rankPercentile>82</rankPercentile>
      <occurrencesPerMillion>4.9</occurrencesPerMillion>
    </queryWord>
    <queryWord>
      <word>resonance</word>
      <exists>True</exists>
      <rankPercentile>64</rankPercentile>
      <occurrencesPerMillion>1.7</occurrencesPerMillion>
    </queryWord>
    ...
  </responsedata>
</autnresponse>

The response includes a queryWord element for each of the input words.

  • The exists element specifies whether the word exists in the vocabulary. If this element has a value of false you might be able to improve the speech-to-text accuracy by training a custom language model that includes the missing word.
  • The rankPercentile element (present only when the word exists) indicates how likely the word is to appear relative to other words. The most common one percent of words have a rankPercentile value of 100 (so a greater value indicates a more common word).
  • The occurrencesPerMillion element (present only when the word exists) shows the number of times that the word is expected to occur in one million words.