FST  openfst-1.7.2
OpenFst Library
compress-script.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 // Definitions of 'scriptable' versions of compression operations, that is,
5 // those that can be called with FstClass-type arguments.
6 //
7 // See comments in nlp/fst/script/script-impl.h for how the registration
8 // mechanism allows these to work with various arc types.
9 
11 
12 #include <fst/arc-map.h>
13 #include <fst/script/script-impl.h>
14 
15 namespace fst {
16 namespace script {
17 
18 void Compress(const FstClass &fst, const string &filename, const bool gzip) {
19  CompressArgs args(fst, filename, gzip);
20  Apply<Operation<CompressArgs>>("Compress", fst.ArcType(), &args);
21 }
22 
23 void Decompress(const string &filename, MutableFstClass *fst, const bool gzip) {
24  DecompressArgs args(filename, fst, gzip);
25  Apply<Operation<DecompressArgs>>("Decompress", fst->ArcType(), &args);
26 }
27 
28 // Register operations for common arc types.
29 
33 
37 
38 } // namespace script
39 } // namespace fst
const string & ArcType() const final
Definition: fst-class.h:290
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
std::tuple< const string &, MutableFstClass *, const bool > DecompressArgs
std::tuple< const FstClass &, const string &, const bool > CompressArgs
void Compress(const FstClass &fst, const string &filename, const bool gzip)
void Decompress(const string &filename, MutableFstClass *fst, const bool gzip)