FST  openfst-1.6.1
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 
10 #include <utility>
11 #include <vector>
12 
14 
15 #include <fst/script/script-impl.h>
16 
17 namespace fst {
18 namespace script {
19 
20 void Compress(const FstClass &fst, const string &filename, const bool gzip) {
21  CompressArgs args(fst, filename, gzip);
22  Apply<Operation<CompressArgs>>("Compress", fst.ArcType(), &args);
23 }
24 
25 void Decompress(const string &filename, MutableFstClass *fst, const bool gzip) {
26  DecompressArgs args(filename, fst, gzip);
27  Apply<Operation<DecompressArgs>>("Decompress", fst->ArcType(), &args);
28 }
29 
30 // Register operations for common arc types.
31 
35 
39 
40 } // namespace script
41 } // namespace fst
const string & ArcType() const override
Definition: fst-class.h:289
REGISTER_FST_OPERATION(Compress, StdArc, CompressArgs)
void Compress(const FstClass &fst, const string &filename, const bool gzip)
void Decompress(const string &filename, MutableFstClass *fst, const bool gzip)