FST  openfst-1.8.2.post1
OpenFst Library
compile.cc
Go to the documentation of this file.
1 // Copyright 2005-2020 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the 'License');
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an 'AS IS' BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 // See www.openfst.org for extensive documentation on this weighted
16 // finite-state transducer library.
17 
18 #include <fst/script/compile.h>
19 
20 #include <string>
21 #include <utility>
22 
23 #include <fst/script/script-impl.h>
24 
25 namespace fst {
26 namespace script {
27 
28 void Compile(std::istream &istrm, const std::string &source,
29  const std::string &dest, const std::string &fst_type,
30  const std::string &arc_type, const SymbolTable *isyms,
31  const SymbolTable *osyms, const SymbolTable *ssyms, bool accep,
32  bool ikeep, bool okeep, bool nkeep, bool allow_negative_labels) {
33  std::unique_ptr<FstClass> fst(
34  CompileInternal(istrm, source, fst_type, arc_type, isyms, osyms, ssyms,
35  accep, ikeep, okeep, nkeep, allow_negative_labels));
36  fst->Write(dest);
37 }
38 
39 std::unique_ptr<FstClass> CompileInternal(
40  std::istream &istrm, const std::string &source, const std::string &fst_type,
41  const std::string &arc_type, const SymbolTable *isyms,
42  const SymbolTable *osyms, const SymbolTable *ssyms, bool accep, bool ikeep,
43  bool okeep, bool nkeep, bool allow_negative_labels) {
44  FstCompileInnerArgs iargs{istrm,
45  source,
46  fst_type,
47  isyms,
48  osyms,
49  ssyms,
50  accep,
51  ikeep,
52  okeep,
53  nkeep,
54  allow_negative_labels};
55  FstCompileArgs args(iargs);
56  Apply<Operation<FstCompileArgs>>("CompileInternal", arc_type, &args);
57  return std::move(args.retval);
58 }
59 
60 // This registers form 2; 1 does not require registration.
62 
63 } // namespace script
64 } // namespace fst
void Compile(std::istream &istrm, const std::string &source, const std::string &dest, const std::string &fst_type, const std::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:28
REGISTER_FST_OPERATION_3ARCS(Compress, CompressArgs)
void CompileInternal(FstCompileArgs *args)
Definition: compile.h:59