Cambridge SMT System
main.createssgrammar.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 initAllCreateSSGrammarOptions (po::options_description& desc) {
27  desc.add_options()
28  ( HifstConstants::kRangeExtended.c_str(), po::value<std::string>(),
29  "Indices of sentences to process" )
30  ( HifstConstants::kNThreads.c_str(), po::value<unsigned>(),
31  "Number of threads (trimmed to number of cpus in the machine) " )
32  ( HifstConstants::kGrammarLoad.c_str(), po::value<std::string>(),
33  "Load a synchronous context-free grammar file" )
35  po::value<std::string>()->default_value ( "1" ),
36  "One or more scales. Must match the number of features in the grammar" )
38  po::value<std::string>()->default_value ( "" ),
39  "Store a file containing patterns" )
41  po::value<std::string>()->default_value ( "" ),
42  "Store a file containing non-terminal table" )
44  po::value<std::string>()->default_value ( "-" ),
45  "Source text file -- this option is ignored in server mode" )
47  po::value<std::string>()->default_value ( "no" ),
48  "Tokenize input (yes|no) -- NOT IMPLEMENTED" )
50  po::value<std::string>()->default_value ( "" ), "NOT IMPLEMENTED" )
52  "Add sentence markers to tokenized input" )
54  po::value<std::string>()->default_value ( "" ),
55  "Loads a map file that will be used to integer-map the words of the source sentence. " )
57  po::value<unsigned>()->default_value ( 10 ), "Maximum span" )
59  po::value<unsigned>()->default_value ( 9 ), "Maximum gap span" )
61  po::value<std::string>()->default_value ( "" ), "wordmap file" )
63  po::value<std::string>()->default_value ( "" ),
64  "Store sentence-specific grammar" )
66  po::value<std::string>()->default_value ( "no" ), "Add oov rules (yes|no)" )
68  po::value<std::string>()->default_value ( "yes" ),
69  "If OOVs added, then delete oovs rather than pass them through (yes|no)" )
70  ;
71 }
72 
73 inline void checkCreateSSGrammarOptions (po::variables_map *vm) {
74  if ( vm->count ( HifstConstants::kGrammarLoad.c_str() ) ) {
76  ( *vm ) [HifstConstants::kGrammarLoad.c_str()].as<std::string>() );
77  } else {
78  LERROR ( HifstConstants::kGrammarLoad << " not defined" );
79  exit ( EXIT_FAILURE );
80  }
81  if ( vm->count ( HifstConstants::kSourceLoad.c_str() ) ) {
83  ( *vm ) [HifstConstants::kSourceLoad.c_str()].as<std::string>() );
84  } else if ( vm->count ( HifstConstants::kServerEnable.c_str() ) ) {
86  " not defined, mandatory unless running on server mode " );
87  exit ( EXIT_FAILURE );
88  }
89 }
90 
91 }
92 } // end namespaces
void checkCreateSSGrammarOptions(po::variables_map *vm)
const std::string kServerEnable
const std::string kPreproTokenizeEnable
const std::string kGrammarFeatureweights
const std::string kPreproWordmapLoad
const std::string kPatternstoinstancesStore
#define LDEBUG(msg)
std::string const kRangeExtended
List of constants to be used both across program options and class runners.
const std::string kNThreads
const std::string kSsgrammarAddoovsSourcedeletions
const std::string kSsgrammarAddoovsEnable
const std::string kPreproAddsentencemarkers
void initAllCreateSSGrammarOptions(po::options_description &desc)
const std::string kSourceLoad
const std::string kSsgrammarStore
const std::string kGrammarStorepatterns
#define LERROR(msg)
const std::string kPatternstoinstancesGapmaxspan
const std::string kGrammarStorentorder
const std::string kPreproTokenizeLanguage
Definition: bleu.hpp:14
const std::string kPatternstoinstancesMaxspan
const std::string kGrammarLoad