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:
authorUlrich Germann <Ulrich.Germann@gmail.com>2015-10-31 15:50:52 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-10-31 15:50:52 +0300
commit324c378f7fc54f02a8ea264915d3eade867ff23d (patch)
tree2bb934fee448845b0524427d437c871e7118ac2c /moses/Syntax
parentdc8ad899454bd82408c6a371d5f50e497ede0caa (diff)
Options refactoring. Moses crashed in server mode when asked to provide n-best translations with scores.
Diffstat (limited to 'moses/Syntax')
-rw-r--r--moses/Syntax/Manager.cpp13
-rw-r--r--moses/Syntax/S2T/OovHandler-inl.h6
2 files changed, 9 insertions, 10 deletions
diff --git a/moses/Syntax/Manager.cpp b/moses/Syntax/Manager.cpp
index 10b0d25c9..9a22b593a 100644
--- a/moses/Syntax/Manager.cpp
+++ b/moses/Syntax/Manager.cpp
@@ -26,12 +26,12 @@ void Manager::OutputBest(OutputCollector *collector) const
const SHyperedge *best = GetBestSHyperedge();
if (best == NULL) {
VERBOSE(1, "NO BEST TRANSLATION" << std::endl);
- if (StaticData::Instance().GetOutputHypoScore()) {
+ if (options().output.ReportHypoScore) {
out << "0 ";
}
out << '\n';
} else {
- if (StaticData::Instance().GetOutputHypoScore()) {
+ if (options().output.ReportHypoScore) {
out << best->label.score << " ";
}
Phrase yield = GetOneBestTargetYield(*best);
@@ -49,12 +49,10 @@ void Manager::OutputBest(OutputCollector *collector) const
void Manager::OutputNBest(OutputCollector *collector) const
{
if (collector) {
- const StaticData &staticData = StaticData::Instance();
long translationId = m_source.GetTranslationId();
-
KBestExtractor::KBestVec nBestList;
- ExtractKBest(staticData.options().nbest.nbest_size, nBestList,
- staticData.options().nbest.only_distinct);
+ ExtractKBest(options().nbest.nbest_size, nBestList,
+ options().nbest.only_distinct);
OutputNBestList(collector, nBestList, translationId);
}
}
@@ -111,7 +109,8 @@ void Manager::OutputNBestList(OutputCollector *collector,
out << translationId << " ||| ";
OutputSurface(out, outputPhrase, outputFactorOrder, false);
out << " ||| ";
- derivation.scoreBreakdown.OutputAllFeatureScores(out);
+ bool with_labels = options().nbest.include_feature_labels;
+ derivation.scoreBreakdown.OutputAllFeatureScores(out, with_labels);
out << " ||| " << derivation.score;
// optionally, print word alignments
diff --git a/moses/Syntax/S2T/OovHandler-inl.h b/moses/Syntax/S2T/OovHandler-inl.h
index 9f26563d5..3655a0155 100644
--- a/moses/Syntax/S2T/OovHandler-inl.h
+++ b/moses/Syntax/S2T/OovHandler-inl.h
@@ -66,7 +66,7 @@ template<typename RuleTrie>
TargetPhrase *OovHandler<RuleTrie>::SynthesizeTargetPhrase(
const Word &oov, const Phrase &srcPhrase, const Word &targetLhs, float prob)
{
- const StaticData &staticData = StaticData::Instance();
+ const StaticData &SD = StaticData::Instance();
const UnknownWordPenaltyProducer &unknownWordPenaltyProducer =
UnknownWordPenaltyProducer::Instance();
@@ -82,8 +82,8 @@ TargetPhrase *OovHandler<RuleTrie>::SynthesizeTargetPhrase(
targetPhrase->EvaluateInIsolation(srcPhrase);
targetPhrase->SetTargetLHS(&targetLhs);
targetPhrase->SetAlignmentInfo("0-0");
- if (staticData.IsDetailedTreeFragmentsTranslationReportingEnabled() ||
- staticData.GetTreeStructure() != NULL) {
+ if (!SD.options().output.detailed_tree_transrep_filepath.empty() ||
+ SD.GetTreeStructure() != NULL) {
std::string value = "[ " + targetLhs[0]->GetString().as_string() + " " +
oov[0]->GetString().as_string() + " ]";
targetPhrase->SetProperty("Tree", value);