Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@edobashira
Created August 10, 2012 05:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edobashira/3311387 to your computer and use it in GitHub Desktop.
Save edobashira/3311387 to your computer and use it in GitHub Desktop.
Shim code to create shared object o register Kaldi lattice with OpenFst command line tools
//Compile something like (assumes the Kaldi/OpenFst headers are on the include path)
// g++ -g kaldi-arc.cc -o lattice4-arc.so \
// -shared -I/path/to/kaldi/src -DHAVE_ATLAS -fPIC
//Add the dir containing lattice4-arc.so to the LD_LIBRARY_PATH
#include <fst/const-fst.h>
#include <fst/edit-fst.h>
#include <fst/vector-fst.h>
#include <fst/script/register.h>
#include <fst/script/fstscript.h>
#include <lat/kaldi-lattice.h>
using namespace fst;
using kaldi::LatticeArc;
namespace fst {
namespace script {
REGISTER_FST(VectorFst, LatticeArc);
REGISTER_FST(ConstFst, LatticeArc);
REGISTER_FST(EditFst, LatticeArc);
REGISTER_FST_CLASSES(LatticeArc);
REGISTER_FST_OPERATIONS(LatticeArc);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment