HTK Pronunciation Dictionary Error

The Hidden Markov Model Toolkit (HTK) is a great resource, but the errors produced can be cryptic at times.  Recently I was stumped with an interesting one.

ERROR [+8050] ReadDict: Probability malformed nang

Basically I had a dictionary entry whose pronunciation was a single model called “nang” (the meaning of that model is unimportant) and HTK did not like it.  After hunting through the HTK code, I found the issue.  The ReadDictWord function in HDict.c makes a call to strtod, a C function to convert a string to a floating point number, for the first bit of text after the word name.  Typically a string of letters does not produce a meaningful value and the code handles that accordingly.  However, the strtod function views a string beginning with nan to represent NaN (a similar issue arises for string starting with inf).

HTK took this to mean that I had given this pronunciation a probability of NaN and rightly returns this error.  The code can be altered to account for this issue, but the simplest fix is to add the default probability value of 1.0 to the pronunciation.

This entry was posted in Research and tagged , , , , . Bookmark the permalink.

3 Responses to HTK Pronunciation Dictionary Error

  1. Michael says:

    Hi William,
    thanks for that article! Great thing, I faced something very similar with the word “infrared”, as strtod thinks this is infinity….

  2. Peter says:

    thanks for this post, you made me think that word starting with numbers could also cause a problem

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s