Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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