Cambridge SMT System
hifst.main.cpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use these files except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License.
12 
13 // Copyright 2012 - Gonzalo Iglesias, AdriĆ  de Gispert, William Byrne
14 
15 #define HIFST
16 
24 #include <main.hifst.hpp>
26 #include <main.custom_assert.hpp>
27 #include <main.logger.hpp>
28 #include <main-run.hifst.hpp>
30 #include <common-helpers.hpp>
31 #include <main.hpp>
32 
36 template < template <class> class DataT
37  , class ArcT
38  >
39 struct RunHifst {
40  explicit RunHifst(ucam::util::RegistryPO const &rg){
45  (RunTask3<SingleThreadedHifstTask
46  , MultiThreadedHifstTask
47  , HifstServerTask
48  , DataT
49  , ArcT >
50  (rg) );
51  }
52 };
53 
55  using namespace HifstConstants;
56  using namespace ::ucam::fsttools;
57  std::string const arctype =rg_->get<std::string>(kHifstSemiring);
58  using namespace ucam::hifst;
59  if (arctype == kHifstSemiringLexStdArc) {
61  } else if (arctype == HifstConstants::kHifstSemiringTupleArc) {
63  if (rg_->getBool(kRulesToWeightsEnable)) {
65  r2w();
66  }
67  } else if (arctype == kHifstSemiringStdArc) {
68  LWARN("Currently untested, might work in exact decoding:" << kHifstSemiringStdArc );
70  } else {
71  LERROR("Unsupported semiring option");
72  exit(EXIT_FAILURE);
73  }
74 }
std::string const kHifstSemiring
Implements lats2splats tool.
Include all necessary headers here.
Definition: hifst.main.cpp:39
Full multi-threaded Translation system.
const std::string kRulesToWeightsEnable
RunHifst(ucam::util::RegistryPO const &rg)
Definition: hifst.main.cpp:40
void run()
Include all necessary headers here.
std::string const kHifstSemiringLexStdArc
std::string const kHifstSemiringStdArc
Static variables for logger. Include only once from main file.
std::string const kHifstSemiringTupleArc
#define LWARN(msg)
Full single-threaded Translation system.
Full single-threaded Alignment lattices to Sparse lattices.
Included headers for all the binary should be defined here. This file should be included only once...
Generic Runner3 class wrapper with the usual template structure required by hifst. It can be used by other tools that should support a server mode (see Runner2/Runner3 details).
#define LERROR(msg)
Contains hifst core: implements single threaded, multithreaded or as server.
Static variable for custom_assert. Include only once from main file.