[SRILM User List] SRILM manipulates lattices as files only?

Andreas Stolcke stolcke at icsi.berkeley.edu
Mon Aug 22 09:08:11 PDT 2011


s a wrote:
>
>     I am using pocketsphinx as decoder for my android application.
>     and I intend to use SRILM for sausage generation.
>
>     I was able to generate the htk format lattice using the -outlatfmt
>     htk parameter in the pocketsphinxbatch command
>
>     i later gave that file as input to the srilm lattice-tool (on
>     cygwin prompt) and got a mesh file 
>
>     Now i want this mesh available in my android application. In my
>     android app i have got a lattice object and i am able to access
>     the words on the nodes of the lattice.
>
>     I need to know which srilm file has the method that would take my
>     lattice object as input and return me a lattice which is in
>     sausage form. (or whether it is possible or not? because i studied
>     the code and i could see lattice being manipulated as a file)
>
You would have to construct the lattice data structure in memory.   The 
best way to learn how to do that (I admit it is somewhat involved) is to 
read the code that reads an HTK lattice file into memory.  You can find 
this in $SRILM/lattice/src/HTKLattice.cc, function Lattice::readHTK(). 

A more straightforward, if somewhat less efficient way would be to write 
the textual HTK lattice representation to a string object, and then 
"read" from that string using Lattice::readHTK().   For this purpose the 
File object can be constructed from a string, see the comment in 
$SRILM/misc/src/File.h .    I believe you need to get the very latest 
(beta) version of SRILM for this to work.

Andreas



More information about the SRILM-User mailing list