lattice-tool and trigram

Andreas Stolcke stolcke at
Wed Jun 23 22:59:52 PDT 2004

In message <1087987449.4078.13.camel at>you wrote:
> Hello,
> I'm trying to expand word lattices with trigrams (and with factored LMs)
> and find a best path (using -viterbi-decode). However, I'm quite
> confused with the lattice-tool, because I cannot really understand what
> it does - sometimes some parameters and options seem to be ignored. 
> I have a word lattice produced with HTK (using bigram LM), and a trigram
> LM in ARPA format.I run:
> lattice-tool -lm -in-lattice <in-lattice> -read-htk
> -viterbi-decode 
> When I try this, I get following output:
> reading 60002 1-grams
> reading 4038368 2-grams
> reading 1184013 3-grams
> Lattice::expandToLM: starting expansion to general LM (maxNodes = 0) ...
> Lattice::bestWords: processing
> Lattice::bestWords: best path prob = -inf
> /home/tanel/devel/data/mfc/fts/sentences/aa/s10000_01.mfc </s>
> Is this caused by the fact that there are !NULL nodes at the start and
> end of the <in_lattice>? I tried adding the -no-htk-nulls -no-nulls
> options but this doesn't seem to help...
> Maybe somebody can provide a correct workflow to get a  trigram-scored
> best path from HTK lattices using lattice-tool?
> Thanks and best regards,
> Tanel Alumäe

You cannot do lattice expansion and decoding in the same run 
(the decoding would happen on the original lattices, not the expanded
ones). So,

1. expand you lattices, store the results
2. decode 1-best words from the expanded lattices

This is also convenient if you want to play with different score weights
in step 2 (since step 1 takes much longer than step 2, typically).

In the first step you might want to also apply some pruning to keep the 
size and runtime manageable.  You CAN do pruning and expansion in the same
run, since the pruning happens before the expansion.

The order of application of the various option of lattice-tool needs to
be documented better.  One of these days ...


More information about the SRILM-User mailing list