Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'moses/parameters/ReportingOptions.cpp')
-rw-r--r--moses/parameters/ReportingOptions.cpp123
1 files changed, 55 insertions, 68 deletions
diff --git a/moses/parameters/ReportingOptions.cpp b/moses/parameters/ReportingOptions.cpp
index 25ae2f779..fa06eb06f 100644
--- a/moses/parameters/ReportingOptions.cpp
+++ b/moses/parameters/ReportingOptions.cpp
@@ -1,5 +1,4 @@
// -*- mode: c++; indent-tabs-mode: nil; tab-width: 2 -*-
-#if 0
#include "ReportingOptions.h"
#include "moses/Parameter.h"
@@ -9,82 +8,70 @@ namespace Moses {
ReportingOptions::
init(Parameter const& param)
{
- PARAM_VEC const* params;
-
- param.SetParameter(segmentation, "report-segmentation", false );
- param.SetParameter(segmentation_enriched, "report-segmentation-enriched", false);
- param.SetParameter(all_factors, "report-all-factors", false );
-
- // print ...
- param.SetParameter(id, "print-id", false );
- param.SetParameter(aln_info, "print-alignment-info", false);
- param.SetParameter(passthrough, "print-passthrough", false );
-
- param.SetParameter<string>(detailed_transrep_filepath, "translation-details", "");
- param.SetParameter<string>(detailed_tree_transrep_filepath,
- "tree-translation-details", "");
- param.SetParameter<string>(detailed_all_transrep_filepath,
- "translation-all-details", "");
-
- // output search graph
- param.SetParameter<string>(output,
- "translation-all-details", "");
-
-
+ // including factors in the output
+ param.SetParameter(ReportAllFactors, "report-all-factors", false);
+
+ // segmentation reporting
+ ReportSegmentation = (param.GetParam("report-segmentation-enriched")
+ ? 2 : param.GetParam("report-segmentation")
+ ? 1 : 0);
+
+ // word alignment reporting
+ param.SetParameter(PrintAlignmentInfo, "print-alignment-info", false);
+ param.SetParameter(WA_SortOrder, "sort-word-alignment", NoSort);
+ std::string e; // hack to save us param.SetParameter<string>(...)
+ param.SetParameter(AlignmentOutputFile,"alignment-output-file", e);
- param.SetParameter(sort_word_alignment, "sort-word-alignment", NoSort);
+ // output a word graph
+ PARAM_VEC const* params;
+ params = param.GetParam("output-word-graph");
+ WordGraph = (params && params->size() == 2); // what are the two options?
+ // dump the search graph
+ param.SetParameter(SearchGraph, "output-search-graph", e);
+ param.SetParameter(SearchGraphExtended, "output-search-graph-extended", e);
+ param.SetParameter(SearchGraphSLF,"output-search-graph-slf", e);
+ param.SetParameter(SearchGraphHG, "output-search-graph-hypergraph", e);
+#ifdef HAVE_PROTOBUF
+ param.SetParameter(SearchGraphPB, "output-search-graph-pb", e);
+#endif
- // Is there a reason why we can't use SetParameter here? [UG]
- = param.GetParam("alignment-output-file");
- if (params && params->size()) {
- m_alignmentOutputFile = Scan<std::string>(params->at(0));
- }
+ param.SetParameter(DontPruneSearchGraph, "unpruned-search-graph", false);
- params = param.GetParam("output-word-graph");
- output_word_graph = (params && params->size() == 2);
+
+ // miscellaneous
+ param.SetParameter(RecoverPath, "recover-input-path",false);
+ param.SetParameter(ReportHypoScore, "output-hypo-score",false);
+ param.SetParameter(PrintID, "print-id",false);
+ param.SetParameter(PrintPassThrough, "print-passthrough",false);
+ param.SetParameter(detailed_all_transrep_filepath,
+ "translation-all-details", e);
+ param.SetParameter(detailed_transrep_filepath, "translation-details", e);
+ param.SetParameter(detailed_tree_transrep_filepath,
+ "tree-translation-details", e);
- // bizarre code ahead! Why do we need to do the checks here?
- // as adapted from StaticData.cpp
- params = param.GetParam("output-search-graph");
- if (params && params->size()) {
- if (params->size() != 1) {
- std::cerr << "ERROR: wrong format for switch -output-search-graph file";
- return false;
- }
- output_search_graph = true;
- }
- else if (m_parameter->GetParam("output-search-graph-extended") &&
- m_parameter->GetParam("output-search-graph-extended")->size()) {
- if (m_parameter->GetParam("output-search-graph-extended")->size() != 1) {
- std::cerr << "ERROR: wrong format for switch -output-search-graph-extended file";
- return false;
+ params = param.GetParam("lattice-samples");
+ if (params) {
+ if (params->size() ==2 ) {
+ lattice_sample_filepath = params->at(0);
+ lattice_sample_size = Scan<size_t>(params->at(1));
+ } else {
+ std::cerr <<"wrong format for switch -lattice-samples file size";
+ return false;
}
- output_search_graph = true;
- m_outputSearchGraphExtended = true;
} else {
- m_outputSearchGraph = false;
- }
-
- params = m_parameter->GetParam("output-search-graph-slf");
- output_search_graph_slf = params && params->size();
- params = m_parameter->GetParam("output-search-graph-hypergraph");
- output_search_graph_hypergraph = params && params->size();
-
-#ifdef HAVE_PROTOBUF
- params = m_parameter->GetParam("output-search-graph-pb");
- if (params && params->size()) {
- if (params->size() != 1) {
- cerr << "ERROR: wrong format for switch -output-search-graph-pb path";
- return false;
+ lattice_sample_size = 0;
}
- m_outputSearchGraphPB = true;
- } else
- m_outputSearchGraphPB = false;
-#endif
-
+ return true;
+ }
+#ifdef HAVE_XMLRPC_C
+ bool
+ ReportingOptions::
+ update(std::map<std::string,xmlrpc_c::value>const& param)
+ {
+ ReportAllFactors = check(param, "report-all-factors");
return true;
}
-}
#endif
+}