Cambridge SMT System
lmert.main.cpp
Go to the documentation of this file.
1 #include <main.custom_assert.hpp>
2 #include <main.logger.hpp>
3 #include <main.lmert.hpp>
4 
5 int main ( int argc, const char* argv[] ) {
6  using namespace ucam::util;
7  using namespace ucam::fsttools;
8  using namespace ucam::lmert;
9  using namespace HifstConstants;
10  initLogger ( argc, argv );
11  FORCELINFO ( argv[0] << " starts!" );
12  RegistryPO rg ( argc, argv );
13  FORCELINFO ( rg.dump ( "CONFIG parameters:\n=====================", "=====================" ) );
14  std::string extTok(rg.exists(kLmertExternalTokenizer) ? rg.getString(kLmertExternalTokenizer) : "");
15  std::string wMap(rg.exists(kLmertWMap) ? rg.getString(kLmertWMap) : "");
16  std::string refFiles;
17  bool intRefs;
18  if (rg.exists(kLmertWordRefs)) {
19  refFiles = rg.getString(kLmertWordRefs);
20  intRefs = false;
21  }
22  if (rg.exists(kLmertIntRefs)) {
23  refFiles = rg.getString(kLmertIntRefs);
24  intRefs = true;
25  }
26  unsigned int bleuCacheSize = rg.get<int>(kLmertBleuCacheSize);
27  BleuScorer bleuScorer(refFiles, extTok, bleuCacheSize, intRefs, wMap);
28  TuneSet< TupleArc32 > tuneSet(rg);
29  PARAMS32 lambda = ParseParamString<float>(rg.getString(kLmertInitialParams));
30  RandomLineSearch< TupleArc32 > rls(rg, tuneSet, bleuScorer, lambda);
31  LINFO(bleuScorer.CacheStats());
32  FORCELINFO (argv[0] << " finished!");
33 }
std::string const kLmertWordRefs
#define LINFO(msg)
int main(int argc, const char *argv[])
Definition: lmert.main.cpp:5
T get(const std::string &key) const
Returns parsed value associated to key.
Definition: registrypo.hpp:194
void initLogger(int argc, const char *argv[])
Inits logger, parses param options checking for –logger.verbose.
#define FORCELINFO(msg)
std::string const kLmertWMap
Static variables for logger. Include only once from main file.
std::vector< float > PARAMS32
Definition: bleu.hpp:18
std::string getString(const std::string &key) const
Performs get<string> and checks whether the real value is to be loaded from file (–param=file://.....)
Definition: registrypo.hpp:205
bool exists(const std::string &key) const
Determines whether a program option (key) has been defined by the user.
Definition: registrypo.hpp:235
std::string const kLmertIntRefs
std::string dump(const std::string &decorator_start="", const std::string &decorator_end="")
Dumps all configuration parameters into a string with a reasonably pretty format. ...
Definition: registrypo.hpp:108
std::string const kLmertInitialParams
std::string const kLmertBleuCacheSize
std::string const kLmertExternalTokenizer
Static variable for custom_assert. Include only once from main file.