Skip to content

Instantly share code, notes, and snippets.

@edobashira
Created May 13, 2014 18:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edobashira/1a9caea562ba075f8e1d to your computer and use it in GitHub Desktop.
Save edobashira/1a9caea562ba075f8e1d to your computer and use it in GitHub Desktop.
Kaldi OpenFst 1.4 patch
Index: src/Makefile
===================================================================
--- src/Makefile (revision 3967)
+++ src/Makefile (working copy)
@@ -92,7 +92,7 @@
# delete or comment out the lines below.
OPENFST_VER = $(shell grep 'PACKAGE_VERSION' ../tools/openfst/Makefile | sed -e 's:.*= ::')
test_dependencies:
- @[ "$(OPENFST_VER)" == '1.2.10' ] || [ "$(OPENFST_VER)" == '1.3.2' ] || [ "$(OPENFST_VER)" == '1.3.4' ] || { echo "You now need openfst-1.2.10. Do: cd ../tools; svn update; ./install.sh; cd ../src; make depend; make"; exit 1; };
+ @[ "$(OPENFST_VER)" == '1.4.0' ] || { echo "You now need openfst-1.4.0. Do: cd ../tools; svn update; ./install.sh; cd ../src; make depend; make"; exit 1; };
check_portaudio:
@[ -d ../tools/portaudio ] || ( cd ../tools; ./install_portaudio.sh )
Index: src/bin/phones-to-prons.cc
===================================================================
--- src/bin/phones-to-prons.cc (revision 3967)
+++ src/bin/phones-to-prons.cc (working copy)
@@ -170,7 +170,7 @@
<< "not reach end-state, or mismatched lexicon.)";
if (g_kaldi_verbose_level >= 2) {
KALDI_LOG << "phn2word FST is below:";
- fst::FstPrinter<StdArc> fstprinter(phn2word, NULL, NULL, NULL, false, true);
+ fst::FstPrinter<StdArc> fstprinter(phn2word, NULL, NULL, NULL, false, true, "\t");
fstprinter.Print(&std::cerr, "standard error");
KALDI_LOG << "phone sequence is: ";
for (size_t i = 0; i < phones.size(); i++)
Index: src/configure
===================================================================
--- src/configure (revision 3967)
+++ src/configure (working copy)
@@ -514,7 +514,7 @@
failure makefiles/common.mk not found
fi
-echo "Checking OpenFST library in $FSTROOT ..."
+echo "Checking OpenFst library in $FSTROOT ..."
if [ ! -f $FSTROOT/include/fst/fst.h ]; then
failure "Could not find file $FSTROOT/include/fst/fst.h:
you may not have installed OpenFst. See ../tools/INSTALL"
Index: src/decoder/faster-decoder.h
===================================================================
--- src/decoder/faster-decoder.h (revision 3967)
+++ src/decoder/faster-decoder.h (working copy)
@@ -30,9 +30,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
namespace kaldi {
Index: src/decoder/lattice-simple-decoder.h
===================================================================
--- src/decoder/lattice-simple-decoder.h (revision 3967)
+++ src/decoder/lattice-simple-decoder.h (working copy)
@@ -33,9 +33,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
namespace kaldi {
Index: src/decoder/nbest-decoder.h
===================================================================
--- src/decoder/nbest-decoder.h (revision 3967)
+++ src/decoder/nbest-decoder.h (working copy)
@@ -24,7 +24,7 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
#include "util/stl-utils.h"
#include "itf/options-itf.h"
@@ -677,7 +677,7 @@
TokenHash toks_;
const fst::Fst<fst::StdArc> &fst_;
NBestDecoderOptions opts_;
- typedef std::tr1::unordered_set<StateId> StateQueue;
+ typedef std::unordered_set<StateId> StateQueue;
StateQueue queue_; // used in PropagateEpsilon,
// std::vector<StateId> queue_; // temp variable used in PropagateEpsilon,
std::vector<BaseFloat> tmp_array_; // used in GetCutoff.
Index: src/decoder/simple-decoder.h
===================================================================
--- src/decoder/simple-decoder.h (revision 3967)
+++ src/decoder/simple-decoder.h (working copy)
@@ -31,9 +31,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
namespace kaldi {
Index: src/fstext/Makefile
===================================================================
--- src/fstext/Makefile (revision 3967)
+++ src/fstext/Makefile (working copy)
@@ -12,13 +12,14 @@
TESTFILES = determinize-star-test \
pre-determinize-test trivial-factor-weight-test \
- context-fst-test factor-test table-matcher-test fstext-utils-test \
+ factor-test table-matcher-test fstext-utils-test \
remove-eps-local-test rescale-test lattice-weight-test \
determinize-lattice-test lattice-utils-test deterministic-fst-test \
push-special-test epsilon-property-test prune-special-test
OBJFILES = push-special.o
+#context-fst-test
LIBNAME = kaldi-fstext
Index: src/fstext/context-fst-inl.h
===================================================================
--- src/fstext/context-fst-inl.h (revision 3967)
+++ src/fstext/context-fst-inl.h (working copy)
@@ -41,9 +41,10 @@
VectorToStateIter iter = state_map_.find(seq);
if (iter == state_map_.end()) { // Not already in map.
StateId this_state_id = (StateId)state_seqs_.size();
- StateId this_state_id_check = CacheImpl<Arc>::AddState();
- // goes back to VectorFstBaseImpl<Arc>, inherited via CacheFst<Arc>
- assert(this_state_id == this_state_id_check);
+ //Not needed with new version of OpenFst 1.40
+ //StateId this_state_id_check = CacheImpl<Arc>::NumKnownStates();
+ //goes back to VectorFstBaseImpl<Arc>, inherited via CacheFst<Arc>
+ //assert(this_state_id == this_state_id_check);
state_seqs_.push_back(seq);
state_map_[seq] = this_state_id;
return this_state_id;
@@ -321,16 +322,16 @@
// We just try adding all possible symbols on the output side.
Arc arc;
- if (this->CreateArc(s, subsequential_symbol_, &arc)) this->AddArc(s, arc);
+ if (this->CreateArc(s, subsequential_symbol_, &arc)) this->PushArc(s, arc);
for (typename kaldi::ConstIntegerSet<Label>::iterator iter = phone_syms_.begin();
iter != phone_syms_.end(); ++iter) {
Label phone = *iter;
- if (this->CreateArc(s, phone, &arc)) this->AddArc(s, arc);
+ if (this->CreateArc(s, phone, &arc)) this->PushArc(s, arc);
}
for (typename kaldi::ConstIntegerSet<Label>::iterator iter = disambig_syms_.begin();
iter != disambig_syms_.end(); ++iter) {
Label disambig_sym = *iter;
- if (this->CreateArc(s, disambig_sym, &arc)) this->AddArc(s, arc);
+ if (this->CreateArc(s, disambig_sym, &arc)) this->PushArc(s, arc);
}
this->SetArcs(s); // mark the arcs as "done". [so HasArcs returns true].
}
Index: src/fstext/context-fst.h
===================================================================
--- src/fstext/context-fst.h (revision 3967)
+++ src/fstext/context-fst.h (working copy)
@@ -54,12 +54,11 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
#include <fst/fstlib.h>
#include <fst/fst-decl.h>
-#include <fst/slist.h>
#include "util/const-integer-set.h"
@@ -90,6 +89,8 @@
typedef typename Arc::Weight Weight;
typedef typename Arc::StateId StateId;
typedef typename Arc::Label Label;
+ typedef DefaultCacheStore<Arc> Store;
+ typedef typename Store::State State;
typedef unordered_map<vector<LabelT>,
StateId, kaldi::VectorHasher<LabelT> > VectorToStateType;
@@ -208,15 +209,15 @@
friend class StateIterator< ContextFst<Arc> >;
// We have to supply the default template argument below to work around a
// Visual Studio bug.
- friend class CacheArcIterator< ContextFst<Arc>,
- DefaultCacheStateAllocator<CacheState<Arc> > >;
+ //friend class CacheArcIterator< ContextFst<Arc>,
+ // DefaultCacheStateAllocator<CacheState<Arc> > >;
typedef typename Arc::Weight Weight;
typedef typename Arc::Label Label;
typedef typename Arc::StateId StateId;
- typedef CacheState<Arc> State;
+ typedef DefaultCacheStore<Arc> Store;
+ typedef typename Store::State State;
-
/// See \ref graph_context for more details.
ContextFst(Label subsequential_symbol, // epsilon not allowed.
const vector<LabelT>& phones, // symbols on output side of fst.
Index: src/fstext/deterministic-fst.h
===================================================================
--- src/fstext/deterministic-fst.h (revision 3967)
+++ src/fstext/deterministic-fst.h (working copy)
@@ -50,9 +50,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
#include <string>
#include <utility>
@@ -60,7 +60,7 @@
#include <fst/fstlib.h>
#include <fst/fst-decl.h>
-#include <fst/slist.h>
+#include <forward_list>
#include "util/stl-utils.h"
@@ -187,8 +187,8 @@
/// This class is for didactic purposes, it does not really do anything.
/// It shows how you would wrap a language model. Note: you should probably
-/// have <s> and </s> not be real words in your LM, but <s> correspond somehow
-/// to the initial-state of the LM, and </s> be encoded in the final-probs.
+/// have <s> and <s> not be real words in your LM, but <s> correspond somehow
+/// to the initial-state of the LM, and <s> be encoded in the final-probs.
template<class Arc>
class LmExampleDeterministicOnDemandFst: public DeterministicOnDemandFst<Arc> {
public:
Index: src/fstext/determinize-lattice-inl.h
===================================================================
--- src/fstext/determinize-lattice-inl.h (revision 3967)
+++ src/fstext/determinize-lattice-inl.h (working copy)
@@ -25,10 +25,10 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
#include <vector>
-using std::tr1::unordered_map;
+using std::unordered_map;
#include <climits>
namespace fst {
Index: src/fstext/determinize-star-inl.h
===================================================================
--- src/fstext/determinize-star-inl.h (revision 3967)
+++ src/fstext/determinize-star-inl.h (working copy)
@@ -26,9 +26,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
#include <vector>
#include <climits>
Index: src/fstext/factor-inl.h
===================================================================
--- src/fstext/factor-inl.h (revision 3967)
+++ src/fstext/factor-inl.h (working copy)
@@ -98,7 +98,7 @@
|| state_properties[i] == (kStateArcsIn|kStateArcsOut|kStateIlabelsOut));
vector<StateId> state_mapping(max_state+1, kNoStateId);
- typedef std::tr1::unordered_map<vector<I>, Label, kaldi::VectorHasher<I> > SymbolMapType;
+ typedef std::unordered_map<vector<I>, Label, kaldi::VectorHasher<I> > SymbolMapType;
SymbolMapType symbol_mapping;
Label symbol_counter = 0;
{
Index: src/fstext/fstext-utils.h
===================================================================
--- src/fstext/fstext-utils.h (revision 3967)
+++ src/fstext/fstext-utils.h (working copy)
@@ -384,7 +384,7 @@
os << '\n';
bool acceptor = false, write_one = false;
FstPrinter<Arc> printer(t, t.InputSymbols(), t.OutputSymbols(),
- NULL, acceptor, write_one);
+ NULL, acceptor, write_one, "\t");
printer.Print(&os, "<unknown>");
if (os.fail())
KALDI_WARN << "Stream failure detected.\n";
Index: src/fstext/pre-determinize-test.cc
===================================================================
--- src/fstext/pre-determinize-test.cc (revision 3967)
+++ src/fstext/pre-determinize-test.cc (working copy)
@@ -24,7 +24,7 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
// Just check that it compiles, for now.
Index: src/fstext/prune-special-inl.h
===================================================================
--- src/fstext/prune-special-inl.h (revision 3967)
+++ src/fstext/prune-special-inl.h (working copy)
@@ -118,7 +118,7 @@
// priority costs in ProcessState().
inline OutputStateId GetOutputStateId(InputStateId istate,
const Weight &weight) {
- typedef typename std::tr1::unordered_map<InputStateId, OutputStateId>::iterator IterType;
+ typedef typename std::unordered_map<InputStateId, OutputStateId>::iterator IterType;
IterType iter = state_map_.find(istate);
if (iter == state_map_.end())
return ProcessState(istate, weight);
@@ -150,7 +150,7 @@
Weight beam_;
size_t max_states_;
- std::tr1::unordered_map<InputStateId, OutputStateId> state_map_;
+ std::unordered_map<InputStateId, OutputStateId> state_map_;
std::priority_queue<Task> queue_;
Weight best_weight_; // if not Zero(), then we have now processed a successful path
// through ifst_, and this is the weight.
Index: src/fstext/trivial-factor-weight.h
===================================================================
--- src/fstext/trivial-factor-weight.h (revision 3967)
+++ src/fstext/trivial-factor-weight.h (working copy)
@@ -58,10 +58,10 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
-#include <fst/slist.h>
+using std::unordered_map;
+#include <forward_list>
#include <string>
#include <utility>
#include <vector>
Index: src/kwsbin/kws-search.cc
===================================================================
--- src/kwsbin/kws-search.cc (revision 3967)
+++ src/kwsbin/kws-search.cc (working copy)
@@ -150,8 +150,8 @@
// to do epsilon removal after composition with the keyword FST. They have
// to traverse the resulting FST.
int32 label_count = 1;
- std::tr1::unordered_map<uint64, uint32> label_encoder;
- std::tr1::unordered_map<uint32, uint64> label_decoder;
+ std::unordered_map<uint64, uint32> label_encoder;
+ std::unordered_map<uint32, uint64> label_decoder;
for (StateIterator<KwsLexicographicFst> siter(index); !siter.Done(); siter.Next()) {
StateId state_id = siter.Value();
for (MutableArcIterator<KwsLexicographicFst>
Index: src/lat/determinize-lattice-pruned.cc
===================================================================
--- src/lat/determinize-lattice-pruned.cc (revision 3967)
+++ src/lat/determinize-lattice-pruned.cc (working copy)
@@ -22,10 +22,10 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
#include <vector>
-using std::tr1::unordered_map;
+using std::unordered_map;
#include <climits>
#include "fstext/determinize-lattice.h" // for LatticeStringRepository
#include "fstext/fstext-utils.h"
Index: src/lat/kaldi-lattice.cc
===================================================================
--- src/lat/kaldi-lattice.cc (revision 3967)
+++ src/lat/kaldi-lattice.cc (working copy)
@@ -77,7 +77,7 @@
bool acceptor = true, write_one = false;
fst::FstPrinter<CompactLatticeArc> printer(t, t.InputSymbols(),
t.OutputSymbols(),
- NULL, acceptor, write_one);
+ NULL, acceptor, write_one, "\t");
printer.Print(&os, "<unknown>");
if (os.fail())
KALDI_WARN << "Stream failure detected.\n";
@@ -402,7 +402,7 @@
bool acceptor = false, write_one = false;
fst::FstPrinter<LatticeArc> printer(t, t.InputSymbols(),
t.OutputSymbols(),
- NULL, acceptor, write_one);
+ NULL, acceptor, write_one, "\t");
printer.Print(&os, "<unknown>");
if (os.fail())
KALDI_WARN << "Stream failure detected.\n";
Index: src/lat/kws-functions.cc
===================================================================
--- src/lat/kws-functions.cc (revision 3967)
+++ src/lat/kws-functions.cc (working copy)
@@ -35,7 +35,7 @@
bool ClusterLattice(CompactLattice *clat,
const vector<int32> &state_times) {
using namespace fst;
- using std::tr1::unordered_map;
+ using std::unordered_map;
typedef CompactLattice::StateId StateId;
// Hashmap to store the cluster heads.
Index: src/lm/kaldi-lmtable.h
===================================================================
--- src/lm/kaldi-lmtable.h (revision 3967)
+++ src/lm/kaldi-lmtable.h (working copy)
@@ -30,9 +30,9 @@
#ifdef _MSC_VER
#include <unordered_map>
#else
-#include <tr1/unordered_map>
+#include <unordered_map>
#endif
-using std::tr1::unordered_map;
+using std::unordered_map;
#ifndef HAVE_IRSTLM
#else
Index: src/makefiles/darwin_10_9.mk
===================================================================
--- src/makefiles/darwin_10_9.mk (revision 3967)
+++ src/makefiles/darwin_10_9.mk (working copy)
@@ -12,7 +12,7 @@
-DHAVE_CLAPACK \
-I$(FSTROOT)/include \
$(EXTRA_CXXFLAGS) \
- -g # -O0 -DKALDI_PARANOID
+ -g -O2 -std=c++0x# -O0 -DKALDI_PARANOID
LDFLAGS = -g
LDLIBS = $(EXTRA_LDLIBS) $(FSTROOT)/lib/libfst.a -ldl -lm -lpthread -framework Accelerate
@@ -21,14 +21,6 @@
RANLIB = ranlib
AR = ar
-# On Mac OS 10.9, g++ is actually clang in disguise which by default uses the
-# new c++ standard library libc++. Since openfst uses stuff from the tr1
-# namespace, we need to tell clang to use libstdc++ instead.
-COMPILER = $(shell $(CXX) -v 2>&1 )
-ifeq ($(findstring clang,$(COMPILER)),clang)
- CXXFLAGS += -stdlib=libstdc++
- LDFLAGS += -stdlib=libstdc++
-endif
# We need to tell recent versions of g++ to allow vector conversions without
# an explicit cast provided the vectors are of the same size.
Index: src/makefiles/linux_atlas.mk
===================================================================
--- src/makefiles/linux_atlas.mk (revision 3967)
+++ src/makefiles/linux_atlas.mk (working copy)
@@ -21,7 +21,7 @@
-DHAVE_ATLAS -I$(ATLASINC) \
-I$(FSTROOT)/include \
$(EXTRA_CXXFLAGS) \
- -g # -O0 -DKALDI_PARANOID
+ -g -O2 -std=c++0x # -O0 -DKALDI_PARANOID
ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
Index: src/makefiles/linux_atlas_64bit.mk
===================================================================
--- src/makefiles/linux_atlas_64bit.mk (revision 3967)
+++ src/makefiles/linux_atlas_64bit.mk (working copy)
@@ -43,7 +43,7 @@
-DHAVE_ATLAS -I$(ATLASINC) \
-I$(FSTROOT)/include \
$(EXTRA_CXXFLAGS) \
- -g # -O0 -DKALDI_PARANOID
+ -g -O2 -std=c++0x # -O0 -DKALDI_PARANOID
ifeq ($(KALDI_FLAVOR), dynamic)
CXXFLAGS += -fPIC
Index: src/matrix/packed-matrix.cc
===================================================================
--- src/matrix/packed-matrix.cc (revision 3967)
+++ src/matrix/packed-matrix.cc (working copy)
@@ -420,7 +420,7 @@
}
}
bad:
- KALDI_ERR << "Failed to read packed matrix from stream. " << specific_error
+ KALDI_ERR << "Failed to read packed matrix from stream. " << specific_error.str()
<< " File position at start is "
<< pos_at_start << ", currently " << is.tellg();
}
Index: src/online/online-faster-decoder.cc
===================================================================
--- src/online/online-faster-decoder.cc (revision 3967)
+++ src/online/online-faster-decoder.cc (working copy)
@@ -86,7 +86,7 @@
void OnlineFasterDecoder::UpdateImmortalToken() {
- std::tr1::unordered_set<Token*> emitting;
+ std::unordered_set<Token*> emitting;
for (Elem *e = toks_.GetList(); e != NULL; e = e->tail) {
Token* tok = e->val;
while (tok->arc_.ilabel == 0) //deal with non-emitting ones ...
@@ -102,8 +102,8 @@
}
if (emitting.size() == 0)
break;
- std::tr1::unordered_set<Token*> prev_emitting;
- std::tr1::unordered_set<Token*>::iterator it;
+ std::unordered_set<Token*> prev_emitting;
+ std::unordered_set<Token*>::iterator it;
for (it = emitting.begin(); it != emitting.end(); ++it) {
Token* tok = *it;
Token* prev_token = tok->prev_;
Index: src/online/online-faster-decoder.h
===================================================================
--- src/online/online-faster-decoder.h (revision 3967)
+++ src/online/online-faster-decoder.h (working copy)
@@ -26,9 +26,9 @@
#ifdef _MSC_VER
#include <unordered_set>
#else
-#include <tr1/unordered_set>
+#include <unordered_set>
#endif
-using std::tr1::unordered_set;
+using std::unordered_set;
#include "decoder/faster-decoder.h"
#include "hmm/transition-model.h"
Index: src/util/kaldi-pipebuf.h
===================================================================
--- src/util/kaldi-pipebuf.h (revision 3967)
+++ src/util/kaldi-pipebuf.h (working copy)
@@ -26,7 +26,6 @@
#define KALDI_UTIL_KALDI_PIPEBUF_H_
#include <fstream>
-
namespace kaldi
{
@@ -52,12 +51,14 @@
// code error, if the fptr was good.
return;
}
+
this->_M_mode = mode;
this->_M_buf_size = BUFSIZ;
this->_M_allocate_internal_buffer();
this->_M_reading = false;
this->_M_writing = false;
this->_M_set_buffer(-1);
+
}
}; // class basic_pipebuf
Index: src/util/stl-utils.h
===================================================================
--- src/util/stl-utils.h (revision 3967)
+++ src/util/stl-utils.h (working copy)
@@ -31,11 +31,11 @@
#include <unordered_map>
#include <unordered_set>
#else
-#include <tr1/unordered_map>
-#include <tr1/unordered_set>
+#include <unordered_map>
+#include <unordered_set>
#endif
-using std::tr1::unordered_map;
-using std::tr1::unordered_set;
+using std::unordered_map;
+using std::unordered_set;
namespace kaldi {
Index: tools/Makefile
===================================================================
--- tools/Makefile (revision 3967)
+++ tools/Makefile (working copy)
@@ -5,11 +5,11 @@
# On Mac OS 10.9, g++ is actually clang in disguise which by default uses the
# new c++ standard library libc++. Since openfst uses stuff from the tr1
# namespace, we need to tell clang to use libstdc++ instead.
-COMPILER = $(shell $(CXX) -v 2>&1 )
-ifeq ($(findstring clang,$(COMPILER)),clang)
- CXXFLAGS += -stdlib=libstdc++
- LDFLAGS += -stdlib=libstdc++
-endif
+#COMPILER = $(shell $(CXX) -v 2>&1 )
+#ifeq ($(findstring clang,$(COMPILER)),clang)
+# CXXFLAGS += -stdlib=libstdc++
+# LDFLAGS += -stdlib=libstdc++
+#endif
all: check_required_programs sph2pipe atlas irstlm_tgt sclite openfst
@@ -28,7 +28,7 @@
clean: openfst_cleaned sclite_cleaned irstlm_cleaned
openfst_cleaned:
- $(MAKE) -C openfst-1.3.4 clean
+ $(MAKE) -C openfst-1.4.0 clean
irstlm_cleaned:
$(MAKE) -C irstlm clean
@@ -37,7 +37,7 @@
$(MAKE) -C sctk-2.4.0 clean
distclean:
- rm -rf openfst-1.3.4/
+ rm -rf openfst-1.4.0/
rm -rf sctk-2.4.0/
rm -rf ATLAS/
rm -rf irstlm/
@@ -45,43 +45,45 @@
rm -rf sph2pipe_v2.5.tar.gz
rm -rf atlas3.8.3.tar.gz
rm -rf sctk-2.4.0-20091110-0958.tar.bz2
- rm -rf openfst-1.3.4.tar.gz
+ rm -rf openfst-1.4.0.tar.gz
rm -f openfst
.PHONY: openfst # so target will be made even though "openfst" exists.
-openfst: openfst_compiled openfst-1.3.4/lib
+openfst: openfst_compiled openfst-1.4.0/lib
.PHONY: openfst_compiled
-openfst_compiled: openfst-1.3.4/Makefile
- cd openfst-1.3.4/ && \
- $(MAKE) install
+openfst_compiled: openfst-1.4.0/Makefile
+ cd openfst-1.4.0/ && \
+ $(MAKE) -j4 install
-openfst-1.3.4/lib: | openfst-1.3.4/Makefile
- -cd openfst-1.3.4 && [ -d lib64 ] && [ ! -d lib ] && ln -s lib64 lib
+openfst-1.4.0/lib: | openfst-1.4.0/Makefile
+ -cd openfst-1.4.0 && [ -d lib64 ] && [ ! -d lib ] && ln -s lib64 lib
-openfst-1.3.4/Makefile: openfst-1.3.4/.patched
- cd openfst-1.3.4/; \
- ./configure --prefix=`pwd` --enable-static --enable-shared --enable-far --enable-ngram-fsts CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="-ldl"
+openfst-1.4.0/Makefile: openfst-1.4.0/.patched
+ cd openfst-1.4.0/; \
+ ./configure --prefix=`pwd` --enable-compact-fsts --enable-const-fsts -enable-lookahead-fsts --enable-pdt \
+ --enable-static --enable-shared --enable-far --enable-ngram-fsts --enable-linear-fsts \
+ CXX=$(CXX) CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" LIBS="-ldl"
# patches for openfst. openfst_gcc41up.patch is a patch for openfst to \
# support multi-threads when compile with g++ (gcc) version above 4.1
-openfst-1.3.4/.patched: | openfst-1.3.4
- -cd openfst-1.3.4/src/include/fst; \
+openfst-1.4.0/.patched: | openfst-1.4.0
+ -cd openfst-1.4.0/src/include/fst; \
patch -p0 -N < ../../../../openfst.patch;
- $(CXX) -dumpversion | awk '{if(NR==1 && $$1>"4.1") print "cd openfst-1.3.4/src/include/fst; patch -p0 -N < ../../../../extras/openfst_gcc41up.patch"}' | sh -
+ $(CXX) -dumpversion | awk '{if(NR==1 && $$1>"4.1") print "cd openfst-1.4.0/src/include/fst; patch -p0 -N < ../../../../extras/openfst_gcc41up.patch"}' | sh -
touch $@
-openfst-1.3.4: openfst-1.3.4.tar.gz
- tar xozf openfst-1.3.4.tar.gz
+openfst-1.4.0: openfst-1.4.0.tar.gz
+ tar xozf openfst-1.4.0.tar.gz
-rm openfst
- -ln -s openfst-1.3.4 openfst
+ -ln -s openfst-1.4.0 openfst
-openfst-1.3.4.tar.gz:
- wget http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.3.4.tar.gz || \
- wget -T 10 -t 3 http://www.openslr.org/resources/2/openfst-1.3.4.tar.gz
+openfst-1.4.0.tar.gz:
+ wget http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.4.0.tar.gz || \
+ wget -T 10 -t 3 http://www.openslr.org/resources/2/openfst-1.4.0.tar.gz
sclite: sclite_compiled
Index: tools/openfst.patch
===================================================================
--- tools/openfst.patch (revision 3967)
+++ tools/openfst.patch (working copy)
@@ -224,361 +224,4 @@
};
-*** interval-set.h
-***************
-*** 37,74 ****
- class IntervalSet {
- public:
- struct Interval {
-! T begin;
-! T end;
-
-! Interval() : begin(-1), end(-1) {}
-
-! Interval(T b, T e) : begin(b), end(e) {}
-
- bool operator<(const Interval &i) const {
-! return begin < i.begin || (begin == i.begin && end > i.end);
- }
-
- bool operator==(const Interval &i) const {
-! return begin == i.begin && end == i.end;
- }
-
- bool operator!=(const Interval &i) const {
-! return begin != i.begin || end != i.end;
- }
-
- istream &Read(istream &strm) {
- T n;
- ReadType(strm, &n);
-! begin = n;
- ReadType(strm, &n);
-! end = n;
- return strm;
- }
-
- ostream &Write(ostream &strm) const {
-! T n = begin;
- WriteType(strm, n);
-! n = end;
- WriteType(strm, n);
- return strm;
- }
---- 37,74 ----
- class IntervalSet {
- public:
- struct Interval {
-! T begin_;
-! T end_;
-
-! Interval() : begin_(-1), end_(-1) {}
-
-! Interval(T b, T e) : begin_(b), end_(e) {}
-
- bool operator<(const Interval &i) const {
-! return begin_ < i.begin_ || (begin_ == i.begin_ && end_ > i.end_);
- }
-
- bool operator==(const Interval &i) const {
-! return begin_ == i.begin_ && end_ == i.end_;
- }
-
- bool operator!=(const Interval &i) const {
-! return begin_ != i.begin_ || end_ != i.end_;
- }
-
- istream &Read(istream &strm) {
- T n;
- ReadType(strm, &n);
-! begin_ = n;
- ReadType(strm, &n);
-! end_ = n;
- return strm;
- }
-
- ostream &Write(ostream &strm) const {
-! T n = begin_;
- WriteType(strm, n);
-! n = end_;
- WriteType(strm, n);
- return strm;
- }
-***************
-*** 108,114 ****
- lower_bound(intervals_.begin(), intervals_.end(), interval);
- if (lb == intervals_.begin())
- return false;
-! return (--lb)->end > value;
- }
-
- // Requires intervals be normalized.
---- 108,114 ----
- lower_bound(intervals_.begin(), intervals_.end(), interval);
- if (lb == intervals_.begin())
- return false;
-! return (--lb)->end_ > value;
- }
-
- // Requires intervals be normalized.
-***************
-*** 123,129 ****
-
- bool Singleton() const {
- return intervals_.size() == 1 &&
-! intervals_[0].begin + 1 == intervals_[0].end;
- }
-
-
---- 123,129 ----
-
- bool Singleton() const {
- return intervals_.size() == 1 &&
-! intervals_[0].begin_ + 1 == intervals_[0].end_;
- }
-
-
-***************
-*** 178,194 ****
- T size = 0;
- for (T i = 0; i < intervals_.size(); ++i) {
- Interval &inti = intervals_[i];
-! if (inti.begin == inti.end)
- continue;
- for (T j = i + 1; j < intervals_.size(); ++j) {
- Interval &intj = intervals_[j];
-! if (intj.begin > inti.end)
- break;
-! if (intj.end > inti.end)
-! inti.end = intj.end;
- ++i;
- }
-! count_ += inti.end - inti.begin;
- intervals_[size++] = inti;
- }
- intervals_.resize(size);
---- 178,194 ----
- T size = 0;
- for (T i = 0; i < intervals_.size(); ++i) {
- Interval &inti = intervals_[i];
-! if (inti.begin_ == inti.end_)
- continue;
- for (T j = i + 1; j < intervals_.size(); ++j) {
- Interval &intj = intervals_[j];
-! if (intj.begin_ > inti.end_)
- break;
-! if (intj.end_ > inti.end_)
-! inti.end_ = intj.end_;
- ++i;
- }
-! count_ += inti.end_ - inti.begin_;
- intervals_[size++] = inti;
- }
- intervals_.resize(size);
-***************
-*** 208,224 ****
- oset->count_ = 0;
-
- while (it1 != intervals_.end() && it2 != iintervals->end()) {
-! if (it1->end <= it2->begin) {
- ++it1;
-! } else if (it2->end <= it1->begin) {
- ++it2;
- } else {
- Interval interval;
-! interval.begin = max(it1->begin, it2->begin);
-! interval.end = min(it1->end, it2->end);
- ointervals->push_back(interval);
-! oset->count_ += interval.end - interval.begin;
-! if (it1->end < it2->end)
- ++it1;
- else
- ++it2;
---- 208,224 ----
- oset->count_ = 0;
-
- while (it1 != intervals_.end() && it2 != iintervals->end()) {
-! if (it1->end_ <= it2->begin_) {
- ++it1;
-! } else if (it2->end_ <= it1->begin_) {
- ++it2;
- } else {
- Interval interval;
-! interval.begin_ = max(it1->begin_, it2->begin_);
-! interval.end_ = min(it1->end_, it2->end_);
- ointervals->push_back(interval);
-! oset->count_ += interval.end_ - interval.begin_;
-! if (it1->end_ < it2->end_)
- ++it1;
- else
- ++it2;
-***************
-*** 235,255 ****
- oset->count_ = 0;
-
- Interval interval;
-! interval.begin = 0;
- for (typename vector<Interval>::const_iterator it = intervals_.begin();
- it != intervals_.end();
- ++it) {
-! interval.end = min(it->begin, maxval);
-! if (interval.begin < interval.end) {
- ointervals->push_back(interval);
-! oset->count_ += interval.end - interval.begin;
- }
-! interval.begin = it->end;
- }
-! interval.end = maxval;
-! if (interval.begin < interval.end) {
- ointervals->push_back(interval);
-! oset->count_ += interval.end - interval.begin;
- }
- }
-
---- 235,255 ----
- oset->count_ = 0;
-
- Interval interval;
-! interval.begin_ = 0;
- for (typename vector<Interval>::const_iterator it = intervals_.begin();
- it != intervals_.end();
- ++it) {
-! interval.end_ = min(it->begin_, maxval);
-! if (interval.begin_ < interval.end_) {
- ointervals->push_back(interval);
-! oset->count_ += interval.end_ - interval.begin_;
- }
-! interval.begin_ = it->end_;
- }
-! interval.end_ = maxval;
-! if (interval.begin_ < interval.end_) {
- ointervals->push_back(interval);
-! oset->count_ += interval.end_ - interval.begin_;
- }
- }
-
-***************
-*** 263,269 ****
- oset->count_ = 0;
- } else {
- IntervalSet<T> cset;
-! iset.Complement(intervals_.back().end, &cset);
- Intersect(cset, oset);
- }
- }
---- 263,269 ----
- oset->count_ = 0;
- } else {
- IntervalSet<T> cset;
-! iset.Complement(intervals_.back().end_, &cset);
- Intersect(cset, oset);
- }
- }
-***************
-*** 277,285 ****
- typename vector<Interval>::const_iterator it2 = intervals->begin();
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end <= it2->begin) {
- ++it1;
-! } else if (it2->end <= it1->begin) {
- ++it2;
- } else {
- return true;
---- 277,285 ----
- typename vector<Interval>::const_iterator it2 = intervals->begin();
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end_ <= it2->begin_) {
- ++it1;
-! } else if (it2->end_ <= it1->begin_) {
- ++it2;
- } else {
- return true;
-***************
-*** 300,320 ****
- bool overlap = false; // point in both intervals_ and intervals
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end <= it2->begin) { // no overlap - it1 first
- only1 = true;
- ++it1;
-! } else if (it2->end <= it1->begin) { // no overlap - it2 first
- only2 = true;
- ++it2;
-! } else if (it2->begin == it1->begin && it2->end == it1->end) { // equals
- overlap = true;
- ++it1;
- ++it2;
-! } else if (it2->begin <= it1->begin && it2->end >= it1->end) { // 1 c 2
- only2 = true;
- overlap = true;
- ++it1;
-! } else if (it1->begin <= it2->begin && it1->end >= it2->end) { // 2 c 1
- only1 = true;
- overlap = true;
- ++it2;
---- 300,320 ----
- bool overlap = false; // point in both intervals_ and intervals
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end_ <= it2->begin_) { // no overlap - it1 first
- only1 = true;
- ++it1;
-! } else if (it2->end_ <= it1->begin_) { // no overlap - it2 first
- only2 = true;
- ++it2;
-! } else if (it2->begin_ == it1->begin_ && it2->end_ == it1->end_) { // equals
- overlap = true;
- ++it1;
- ++it2;
-! } else if (it2->begin_ <= it1->begin_ && it2->end_ >= it1->end_) { // 1 c 2
- only2 = true;
- overlap = true;
- ++it1;
-! } else if (it1->begin_ <= it2->begin_ && it1->end_ >= it2->end_) { // 2 c 1
- only1 = true;
- overlap = true;
- ++it2;
-***************
-*** 346,356 ****
- typename vector<Interval>::const_iterator it2 = intervals->begin();
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end <= it2->begin) { // no overlap - it1 first
- ++it1;
-! } else if (it2->begin < it1->begin || it2->end > it1->end) { // no C
- return false;
-! } else if (it2->end == it1->end) {
- ++it1;
- ++it2;
- } else {
---- 346,356 ----
- typename vector<Interval>::const_iterator it2 = intervals->begin();
-
- while (it1 != intervals_.end() && it2 != intervals->end()) {
-! if (it1->end_ <= it2->begin_) { // no overlap - it1 first
- ++it1;
-! } else if (it2->begin_ < it1->begin_ || it2->end_ > it1->end_) { // no C
- return false;
-! } else if (it2->end_ == it1->end_) {
- ++it1;
- ++it2;
- } else {
-***************
-*** 370,376 ****
- ++it) {
- if (it != intervals->begin())
- strm << ",";
-! strm << "[" << it->begin << "," << it->end << ")";
- }
- strm << "}";
- return strm;
---- 370,376 ----
- ++it) {
- if (it != intervals->begin())
- strm << ",";
-! strm << "[" << it->begin_ << "," << it->end_ << ")";
- }
- strm << "}";
- return strm;
+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment