FST  openfst-1.7.1
OpenFst Library
compile.cc
Go to the documentation of this file.
1 // See www.openfst.org for extensive documentation on this weighted
2 // finite-state transducer library.
3 
4 #include <istream>
5 #include <string>
6 
7 #include <fst/script/compile.h>
8 #include <fst/script/fst-class.h>
10 
11 namespace fst {
12 namespace script {
13 
14 void CompileFst(std::istream &istrm, const string &source, const string &dest,
15  const string &fst_type, const string &arc_type,
16  const SymbolTable *isyms, const SymbolTable *osyms,
17  const SymbolTable *ssyms, bool accep, bool ikeep, bool okeep,
18  bool nkeep, bool allow_negative_labels) {
19  std::unique_ptr<FstClass> fst(
20  CompileFstInternal(istrm, source, fst_type, arc_type, isyms, osyms, ssyms,
21  accep, ikeep, okeep, nkeep, allow_negative_labels));
22  fst->Write(dest);
23 }
24 
25 FstClass *CompileFstInternal(std::istream &istrm, const string &source,
26  const string &fst_type, const string &arc_type,
27  const SymbolTable *isyms, const SymbolTable *osyms,
28  const SymbolTable *ssyms, bool accep, bool ikeep,
29  bool okeep, bool nkeep,
30  bool allow_negative_labels) {
31  CompileFstInnerArgs iargs(istrm, source, fst_type, isyms, osyms, ssyms, accep,
32  ikeep, okeep, nkeep, allow_negative_labels);
33  CompileFstArgs args(iargs);
34  Apply<Operation<CompileFstArgs>>("CompileFstInternal", arc_type, &args);
35  return args.retval;
36 }
37 
38 // This registers 2; 1 does not require registration.
42 
43 } // namespace script
44 } // namespace fst
void CompileFst(std::istream &istrm, const string &source, const string &dest, const string &fst_type, const string &arc_type, const SymbolTable *isyms, const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, bool ikeep, bool okeep, bool nkeep, bool allow_negative_labels)
Definition: compile.cc:14
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
void CompileFstInternal(CompileFstArgs *args)
Definition: compile.h:61