Cambridge SMT System
main.applylm.init_param_options_common.hpp
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 
21 namespace ucam {
22 namespace util {
23 
24 namespace po = boost::program_options;
25 
26 inline void initCommonApplylmOptions (po::options_description& desc) {
27  desc.add_options()
29  po::value<std::string>()->default_value ( "1.0" ),
30  "Scaling factors applied to the language models (separated by commas). Assumed as 1 for all language models if not specified " )
32  po::value<std::string>()->default_value ( "0.0" ),
33  "Word penalty applied along the language models (separated by commas). Assumed as 0 if not specified " )
34  ( HifstConstants::kLmLoad.c_str(),
35  po::value<std::string>()->default_value ( "" ),
36  "Load one or more language models (separated by commas)" )
38  po::value<std::string>()->default_value ( "" ),
39  "Use external integer-map file for the language model" )
40  ( HifstConstants::kLmLogTen.c_str(),
41  "Does not convert lm scores to natural log" )
42  ;
43 }
44 
45 inline void checkApplyLmOptions (po::variables_map *vm) {
46  if ( vm->count ( HifstConstants::kLmLoad.c_str() ) ) {
48  ( *vm ) [HifstConstants::kLmLoad.c_str()].as<std::string>() );
49  } else {
50  LERROR ( "Language model file not defined" );
51  exit ( EXIT_FAILURE );
52  }
53 }
54 
55 }
56 } // end namespaces
std::string const kLmLogTen
#define LDEBUG(msg)
std::string const kLmFeatureweights
void checkApplyLmOptions(po::variables_map *vm)
#define LERROR(msg)
std::string const kLmWordmap
std::string const kLmLoad
void initCommonApplylmOptions(po::options_description &desc)
std::string const kLmWordPenalty
Definition: bleu.hpp:14