Cambridge SMT System
applylm.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 
22 #include <main.applylm.hpp>
23 #include <main.custom_assert.hpp>
24 #include <main.logger.hpp>
25 #include <main-run.applylm.hpp>
26 #include <common-helpers.hpp>
27 #include <main.hpp>
28 
32 template < template <class> class DataT
33  , class ArcT
34  >
35 struct RunApplyLm {
36  explicit RunApplyLm(ucam::util::RegistryPO const &rg){
40  (RunTask2<SingleThreadedApplyLanguageModelTask
41  , MultiThreadedApplyLanguageModelTask
42  , DataT
43  , ArcT >
44  (rg) );
45  }
46 };
47 
49  using namespace HifstConstants;
50  using ::ucam::fsttools::SingleThreadedApplyLanguageModelTask;
51  using ::ucam::fsttools::MultiThreadedApplyLanguageModelTask;
52  using ::ucam::fsttools::ApplyLMData;
53  std::string const arctype =rg_->get<std::string>(kHifstSemiring);
54 
55  if (arctype == kHifstSemiringLexStdArc ) {
57  } else if (arctype == kHifstSemiringTupleArc) {
58  // working in hifst and alilats2splats
59  LWARN("Untested, but might work: :) " << kHifstSemiringTupleArc );
61  } else if (arctype == kHifstSemiringStdArc) {
63  } else {
64  LERROR("Unsupported semiring option");
65  exit(EXIT_FAILURE);
66  }
67 }
std::string const kHifstSemiring
RunApplyLm(ucam::util::RegistryPO const &rg)
Concrete RunTaskT implementation for applylm tool.
Generic Runner2 class wrapper with the usual template structure required by the tasks in fsttools and...
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)
Class for single threaded application of language model. It inherits taskinterface behaviour and also...
Class for multithreaded application of language model. Inherits taskinterface and provides standalone...
#define LERROR(msg)
Core implementation of applylm binary. Kicks off either singlethreaded or multithreaded language mode...
Included headers for all the binary should be defined here. This file should be included only once...
Static variable for custom_assert. Include only once from main file.