Cambridge SMT System
main.rules2weights.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 
27 inline void initRules2WeightsOptions (po::options_description& desc
28  , bool addAllOptions=true) {
29  using namespace HifstConstants;
30  if (addAllOptions) {
31  desc.add_options()
32  ( kRangeExtended.c_str(),
33  po::value<std::string>()->default_value ("1"),
34  "Indices of sentences to process" )
35  // Not supported. Very low priority, it's super fast as it is.
36  // ( kNThreads.c_str(), po::value<unsigned>(),
37  // "Number of threads (trimmed to number of cpus in the machine) " )
38 
39  // Not supported yet
40  // ( kRulesToWeightsLatticeFilterbyAlilats.c_str(),
41  // "Filter the flower lattice with the vocabulary of the alignment lattices" )
42  ( kRulesToWeightsLoadGrammar.c_str(), po::value<std::string>(),
43  "Load a synchronous context-free grammar file" )
44  ( kRulesToWeightsLoadalilats.c_str() ,
45  po::value<std::string>(), "Load hifst sparse weight translation lattice" )
47  , po::value<unsigned>()->default_value ( 1 )
48  , "Number of language models" )
49  ;
50  }
51  desc.add_options()
52  ( kRulesToWeightsLatticeStore.c_str() ,
53  po::value<std::string>()->default_value ( "" ),
54  "Store the fst (tropical tuple sparse weight) containing a vector of features per arc " )
55  ;
56 }
57 
58 
59 inline void checkRules2Weightptions (po::variables_map *vm) {
60  using namespace HifstConstants;
61  if ( vm->count ( kRulesToWeightsLoadGrammar.c_str() ) ) {
63  ( *vm ) [kRulesToWeightsLoadGrammar.c_str()].as<std::string>() );
64  } else {
65  LERROR ( "parameter " << kRulesToWeightsLoadGrammar << " not defined" );
66  exit ( EXIT_FAILURE );
67  }
68 };
69 
70 }
71 } // end namespaces
const std::string kRulesToWeightsNumberOfLanguageModels
void initRules2WeightsOptions(po::options_description &desc, bool addAllOptions=true)
#define LDEBUG(msg)
std::string const kRangeExtended
List of constants to be used both across program options and class runners.
const std::string kRulesToWeightsLoadalilats
void checkRules2Weightptions(po::variables_map *vm)
const std::string kRulesToWeightsLoadGrammar
#define LERROR(msg)
const std::string kRulesToWeightsLatticeStore
Definition: bleu.hpp:14