Cambridge SMT System
main.printstrings.init_param_options.hpp
Go to the documentation of this file.
1 #ifndef MAIN_NWCP_INITPARAMOPTIONS_HPP
2 #define MAIN_NWCP_INITPARAMOPTIONS_HPP
3 
10 namespace ucam {
11 namespace util {
12 
13 namespace po = boost::program_options;
14 
28 inline void init_param_options ( int argc, const char* argv[],
29  po::variables_map *vm ) {
30  using namespace HifstConstants;
31 
32  try {
33  po::options_description desc ( "Command-line/configuration file options" );
34  desc.add_options()
35  ( kRangeExtended.c_str(), po::value<std::string>(),
36  "Indices of sentences to translate" )
37  ( kLabelMapExtended.c_str(),
38  po::value<std::string>()->default_value (""),
39  "Map labels to words with this map file" )
40  ( kInput.c_str(), po::value<std::string>()->default_value ("-"),
41  "Read original lattice from [file]" )
42  ( kOutput.c_str(),
43  po::value<std::string>()->default_value ("-"),
44  "Write result" )
45  ( kNbestExtended.c_str(),
46  po::value<unsigned>()->default_value (1), "Number of hypotheses" )
47  ( kUniqueExtended.c_str(), "Unique strings" )
48  ( kWeightExtended.c_str(), "Print weight" )
49  ( kWeightPrecision.c_str(), po::value<unsigned>()->default_value(6), "Weight precision ")
50  ( kSentBleu.c_str(), "compute sentence level bleu (blue+1)" )
51  ( kSuppress.c_str(), "don't print hyps" )
52  ( kLibLinRankFormat.c_str(), "liblinear ranking format (apro)" )
53  ( kIntRefs.c_str(), po::value<std::string>(), "reference strings (integers)" )
54  ( kWordRefs.c_str(), po::value<std::string>(), "reference strings (words)" )
55  ( kExternalTokenizer.c_str(), po::value<std::string>(), "external tokenization script" )
56  ( kSparseFormat.c_str(), "Print weight in sparse format" )
57  ( kSparseDotProduct.c_str(), "Print dot product" )
58  ( kHifstSemiring.c_str(),
59  po::value<std::string>()->default_value ("stdarc"),
60  "Choose between stdarc, lexstdarc, and tuplearc (for the tropical sparse tuple arc semiring)")
61  ( kTupleArcWeights.c_str(), po::value<std::string>(),
62  "Tropic sparse tuple arc weights. "
63  "Comma-separated floats. This needs to be set when the option --semiring=tuplearc is chosen.")
65  "Prints output labels instead of input labels" )
66  ( kPrintInputOutputLabels.c_str(),
67  "Prints both input and output labels" )
68  ( kIntersectionWithHypothesesLoad.c_str(), po::value<std::string>()->default_value("")
69  , "Loads file with hypotheses (input or output depending on parameter to print output labels "
70  " and generates an FSA that intersects "
71  " with input machine before dumping hypothesis. File can be either an FSA "
72  " or a plaintext file with one line per hypothesis (words must be integer mapped)"
73  )
74  ;
75  parseOptionsGeneric (desc, vm, argc, argv);
76  } catch ( std::exception& e ) {
77  cerr << "error: " << e.what() << "\n";
78  exit ( EXIT_FAILURE );
79  } catch ( ... ) {
80  cerr << "Exception of unknown type!\n";
81  exit ( EXIT_FAILURE );
82  }
83  LINFO ( "Configuration loaded" );
84 };
85 
86 }
87 } // end namespaces
88 
89 #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 kUniqueExtended
std::string const kNbestExtended
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 kSentBleu
std::string const kInput
std::string const kExternalTokenizer
std::string const kIntRefs
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 kPrintInputOutputLabels
std::string const kPrintOutputLabelsExtended
std::string const kWeightExtended
std::string const kLibLinRankFormat
std::string const kWeightPrecision
std::string const kTupleArcWeights
std::string const kLabelMapExtended
std::string const kSuppress
std::string const kSparseDotProduct
std::string const kSparseFormat
Definition: bleu.hpp:14
std::string const kIntersectionWithHypothesesLoad