diff options
author | Alexander Gutkin <agutkin@google.com> | 2013-02-28 00:24:20 +0000 |
---|---|---|
committer | Alexander Gutkin <agutkin@google.com> | 2013-02-28 00:24:20 +0000 |
commit | 5b6dc79427b8f7eeb6a7ff68034ab8548ce670ea (patch) | |
tree | 19e17fc79b8873e66f211276d4dd169c480cede1 /src/lib/fst.cc | |
parent | 3da1eb108d36da35333b2d655202791af854996b (diff) | |
download | openfst-5b6dc79427b8f7eeb6a7ff68034ab8548ce670ea.tar.gz |
Bumped OpenFST implementation to openfst-1.3.3-CL41851770.
Updated OpenFST implementation to the most recent version
used by Greco3 (corresponds to nlp::fst exported at Perforce
CL 41851770).
In particular this version has an improved PDT support.
Change-Id: I5aadfc962297eef73922c67e7d57866f11ee7d81
Diffstat (limited to 'src/lib/fst.cc')
-rw-r--r-- | src/lib/fst.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/fst.cc b/src/lib/fst.cc index 69bee35..f4bd95f 100644 --- a/src/lib/fst.cc +++ b/src/lib/fst.cc @@ -52,6 +52,9 @@ DEFINE_bool(fst_align, false, "Write FST data aligned where appropriate"); DEFINE_string(save_relabel_ipairs, "", "Save input relabel pairs to file"); DEFINE_string(save_relabel_opairs, "", "Save output relabel pairs to file"); +DEFINE_string(fst_read_mode, "read", + "Default file reading mode for mappable files"); + namespace fst { // Register VectorFst, ConstFst and EditFst for common arcs types @@ -164,4 +167,27 @@ bool FstHeader::Write(ostream &strm, const string &source) const { return true; } +FstReadOptions::FstReadOptions(const string& src, const FstHeader *hdr, + const SymbolTable* isym, const SymbolTable* osym) + : source(src), header(hdr), isymbols(isym), osymbols(osym) { + mode = ReadMode(FLAGS_fst_read_mode); +} + +FstReadOptions::FstReadOptions(const string& src, const SymbolTable* isym, + const SymbolTable* osym) + : source(src), header(0), isymbols(isym), osymbols(osym) { + mode = ReadMode(FLAGS_fst_read_mode); +} + +FstReadOptions::FileReadMode FstReadOptions::ReadMode(const string &mode) { + if (mode == "read") { + return READ; + } + if (mode == "map") { + return MAP; + } + LOG(ERROR) << "Unknown file read mode " << mode; + return READ; +} + } // namespace fst |