Cambridge SMT System
main.samplehyps.init_param_options.hpp
Go to the documentation of this file.
1 #ifndef MAIN_SAMPLEHYPS_INITPARAMOPTIONS_HPP
2 #define MAIN_SAMPLEHYPS_INITPARAMOPTIONS_HPP
3 
4 namespace ucam {
5 namespace util {
6 
7 namespace po = boost::program_options;
8 
9 inline void init_param_options ( int argc, const char* argv[],
10  po::variables_map *vm ) {
11  try {
12  po::options_description desc ( "Command-line/configuration file options" );
13  desc.add_options()
14  ( HifstConstants::kWordRefs.c_str(), po::value<std::string>()->default_value(""), "reference translations words" )
15  ( HifstConstants::kIntRefs.c_str(), po::value<std::string>()->default_value(""), "reference translations ints" )
16  ( HifstConstants::kExternalTokenizer.c_str(), po::value<std::string>()->default_value(""), "external tokenization command" )
17  ( HifstConstants::kWordMap.c_str(), po::value<std::string>()->default_value(""), "word map for reference translations" )
18  ( HifstConstants::kRangeExtended.c_str(), po::value<std::string>(),
19  "Indices of sentences to translate" )
20  ( HifstConstants::kInput.c_str(), po::value<std::string>()->default_value ("-"),
21  "Read original lattice from [file]" )
22  ( HifstConstants::kOutput.c_str(),
23  po::value<std::string>()->default_value ("-"),
24  "Write result" )
26  po::value<unsigned>()->default_value (1), "Number of hypotheses" )
27  ( HifstConstants::kSparseFormat.c_str(), "Print weight in sparse format" )
28  ( HifstConstants::kAlpha.c_str(), po::value<float>()->default_value(0.05f),
29  "Sampling threshold alpha (see PRO paper)")
30  ( HifstConstants::kRandomSeed.c_str(), po::value<unsigned>(), "Number of samples per source sentence to return")
31  ( HifstConstants::kNSamples.c_str(), po::value<unsigned>()->default_value(50),
32  "Number of samples per source sentence to return")
33  ( HifstConstants::kNegativeExamples.c_str(), "Include negative examples")
34  ( HifstConstants::kDontNegate.c_str(), "Don't negate feature weights")
35  ( HifstConstants::kBinaryTarget.c_str(), "Output binary valued target (for PRO)")
37  po::value<std::string>()->default_value ("stdarc"),
38  "Choose between stdarc, lexstdarc, and tuplearc (for the tropical sparse tuple arc semiring)")
39  ( HifstConstants::kTupleArcWeights.c_str(), po::value<std::string>(),
40  "Tropic sparse tuple arc weights. "
41  "Comma-separated floats. This needs to be set when the option --semiring=tuplearc is chosen.")
42  ;
43  parseOptionsGeneric (desc, vm, argc, argv);
44  } catch ( std::exception& e ) {
45  cerr << "error: " << e.what() << "\n";
46  exit ( EXIT_FAILURE );
47  } catch ( ... ) {
48  cerr << "Exception of unknown type!\n";
49  exit ( EXIT_FAILURE );
50  }
51  LINFO ( "Configuration loaded" );
52 };
53 
54 }
55 } // end namespaces
56 
57 
58 #endif
void parseOptionsGeneric(bpo::options_description &desc, bpo::variables_map *vm, int argc, const char *argv[])
Definition: registrypo.hpp:58
std::string const kHifstSemiring
std::string const kNbestExtended
std::string const kBinaryTarget
std::string const kAlpha
void init_param_options(int argc, const char *argv[], po::variables_map *vm)
Function to initialize boost program_options module with command-line and config file options...
#define LINFO(msg)
std::string const kInput
std::string const kExternalTokenizer
std::string const kIntRefs
std::string const kDontNegate
std::string const kNSamples
std::string const kOutput
std::string const kRangeExtended
List of constants to be used both across program options and class runners.
std::string const kWordRefs
std::string const kRandomSeed
std::string const kWordMap
std::string const kNegativeExamples
std::string const kTupleArcWeights
std::string const kSparseFormat
Definition: bleu.hpp:14