[SRILM User List] lattice-tool with HTK lattice with probabilities

Andreas Stolcke stolcke at icsi.berkeley.edu
Wed May 15 10:03:41 PDT 2013


On 5/15/2013 7:33 AM, tarek abuamer wrote:
>
> What I really need is to combine the original scores and the LM scores 
> in the final score, I don't know whether  this is rescoring or decoding?
>

I'm cc-ing the list since this might be of general interest.

HTK lattices support an "ngram"   score that is separate from the "LM"  
score.   This ngram score is passed through unchanged in the rescoring 
process (just like the acoustic scores).

So what you can do is

1) rewrite your input lattice to replace all "l=score"   to use 
"n=score"  instead ("n" is the key for "ngram" scores).
2) Use lattice-tool -lm to compute new LM scores.
3) Decode the lattices giving nonzero weight to both the ngram and the 
LM score.  So you will get a log linear combination of the two LMs.

         lattice-tool -viterbi-decode -read-htk -htk-lmscale L  
-htk-ngscale N ...

where L is the LM score weight and N is the ngram score weight.   If you 
want to combine the two scores in a different way you can postprocess 
the lattice and insert new scores.  Since all the scores appear on one 
line it should be easy to do this with a gawk / perl / python etc. script.

I hope this answers your question.

Andreas

> *From:*Andreas Stolcke [mailto:stolcke at icsi.berkeley.edu]
> *Sent:* Wednesday, May 15, 2013 4:11 PM
> *To:* tarek abuamer
> *Subject:* Re: [SRILM User List] lattice-tool with HTK lattice with 
> probabilities
>
> On 5/15/2013 4:07 AM, tarek abuamer wrote:
>
>     This is exactly what I am talking about. The weights I put in the
>     input lattice have no effect on the weights in the output lattice
>     (i.e. if I remove the weights from the input lattice it still
>     gives me the same numbers in the output lattice)
>
> Yes, because the use of the -lm option implies "rescoring" the 
> lattice, i.e., recomputing the LM scores.
>
> If you simply want to extract the hypotheses with the highest score, 
> that's called "decoding" and there are several other options for that.
> Read the man page.    You probably want -viterbi-decode.
>
> Andreas
>
>
> *From:*Andreas Stolcke [mailto:stolcke at icsi.berkeley.edu]
> *Sent:* Tuesday, May 14, 2013 9:12 PM
> *To:* tarek abuamer
> *Cc:* srilm-user at speech.sri.com <mailto:srilm-user at speech.sri.com>
> *Subject:* Re: [SRILM User List] lattice-tool with HTK lattice with 
> probabilities
>
> On 5/12/2013 5:06 AM, tarek abuamer wrote:
>
>     I want to use lattice-tool to rescore HTK format lattices. I need
>     HTK lattices to contain probabilities in the form : J=1 S=4 E=2 l=-1.1
>
>     ;& nbsp;&n bsp; J=2 S=4 E=3 l=-0.4
>
>     However, this seems not to have any effect when using lattice-tool.
>
>     Any  clue?
>
>
> You don't say what you tried that didn't work.     If you invoke
>
>      lattice-tool -in-lattice INPUTLATTICE -read-htk -lm LMFILE -order 
> N -out-lattice OUTPUTLATTICE -write-htk
>
> the OUTPUTLATTICE will contain recomputed LM probabilities in the form 
> you describe, assuming the input lattice is also in HTK format.
>
> Andreas
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.speech.sri.com/pipermail/srilm-user/attachments/20130515/2d347619/attachment.html>


More information about the SRILM-User mailing list