home..

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.

Comments? Send me an email.
© 2023 William Hartmann   •  Theme  Moonwalk