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-12-06 04:43:17 +0300
committerUlrich Germann <Ulrich.Germann@gmail.com>2015-12-06 04:43:17 +0300
commitd56d900d6ab5f2cdadbba41dae56de3f19d5d04e (patch)
tree21800a596c7806cba7086a9e919371491339e9e0 /moses/Hypothesis.cpp
parentcf3aef756359788a91e431b568af45d3ecd0b7a6 (diff)
Code cleanup.
Diffstat (limited to 'moses/Hypothesis.cpp')
-rw-r--r--moses/Hypothesis.cpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/moses/Hypothesis.cpp b/moses/Hypothesis.cpp
index ae622b182..6f0807347 100644
--- a/moses/Hypothesis.cpp
+++ b/moses/Hypothesis.cpp
@@ -371,102 +371,102 @@ OutputInput(std::ostream& os) const
if (inp_phrases[i]) os << *inp_phrases[i];
}
-void
-Hypothesis::
-OutputBestSurface(std::ostream &out, const std::vector<FactorType> &outputFactorOrder,
- const ReportingOptions &options) const
-{
- if (m_prevHypo) {
- // recursively retrace this best path through the lattice, starting from the end of the hypothesis sentence
- m_prevHypo->OutputBestSurface(out, outputFactorOrder, options);
- }
- OutputSurface(out, *this, outputFactorOrder, options);
-}
-
-//////////////////////////////////////////////////////////////////////////
-/***
- * print surface factor only for the given phrase
- */
-void
-Hypothesis::
-OutputSurface(std::ostream &out, const Hypothesis &edge,
- const std::vector<FactorType> &outputFactorOrder,
- const ReportingOptions &options) const
-{
- UTIL_THROW_IF2(outputFactorOrder.size() == 0,
- "Must specific at least 1 output factor");
- const TargetPhrase& phrase = edge.GetCurrTargetPhrase();
- // TODO: slay the rest of StaticData here and move stuff into ReportingOptions
- bool markUnknown = GetManager().options().unk.mark;
- bool featureLabels = StaticData::Instance().options().nbest.include_feature_labels;
- if (options.ReportAllFactors == true) {
- out << phrase;
- } else {
- FactorType placeholderFactor
- = StaticData::Instance().options().input.placeholder_factor;
-
- std::map<size_t, const Factor*> placeholders;
- if (placeholderFactor != NOT_FOUND) {
- // creates map of target position -> factor for placeholders
- placeholders = GetPlaceholders(edge, placeholderFactor);
- }
-
- size_t size = phrase.GetSize();
- for (size_t pos = 0 ; pos < size ; pos++) {
- const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
-
- if (placeholders.size()) {
- // do placeholders
- std::map<size_t, const Factor*>::const_iterator iter = placeholders.find(pos);
- if (iter != placeholders.end()) {
- factor = iter->second;
- }
- }
-
- UTIL_THROW_IF2(factor == NULL,
- "No factor 0 at position " << pos);
-
- //preface surface form with UNK if marking unknowns
- const Word &word = phrase.GetWord(pos);
- if(markUnknown && word.IsOOV()) {
- out << GetManager().options().unk.prefix << *factor
- << GetManager().options().unk.suffix;
- } else {
- out << *factor;
- }
-
- for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) {
- const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]);
- UTIL_THROW_IF2(factor == NULL,
- "No factor " << i << " at position " << pos);
-
- out << "|" << *factor;
- }
- out << " ";
- }
- }
-
- // trace ("report segmentation") option "-t" / "-tt"
- if (options.ReportSegmentation > 0 && phrase.GetSize() > 0) {
- const Range &sourceRange = edge.GetCurrSourceWordsRange();
- const int sourceStart = sourceRange.GetStartPos();
- const int sourceEnd = sourceRange.GetEndPos();
- out << "|" << sourceStart << "-" << sourceEnd; // enriched "-tt"
- if (options.ReportSegmentation == 2) {
- out << ",wa=";
- edge.OutputAlignment(out, false);
- // const AlignmentInfo &ai = edge.GetCurrTargetPhrase().GetAlignTerm();
- // Hypothesis::OutputAlignment(out, ai, 0, 0, options.WA_SortOrder);
- out << ",total=";
- out << edge.GetScore() - edge.GetPrevHypo()->GetScore();
- out << ",";
- ScoreComponentCollection scoreBreakdown(edge.GetScoreBreakdown());
- scoreBreakdown.MinusEquals(edge.GetPrevHypo()->GetScoreBreakdown());
- scoreBreakdown.OutputAllFeatureScores(out, featureLabels);
- }
- out << "| ";
- }
-}
+// void
+// Hypothesis::
+// OutputBestSurface(std::ostream &out, const std::vector<FactorType> &outputFactorOrder,
+// const ReportingOptions &options) const
+// {
+// if (m_prevHypo) {
+// // recursively retrace this best path through the lattice, starting from the end of the hypothesis sentence
+// m_prevHypo->OutputBestSurface(out, outputFactorOrder, options);
+// }
+// OutputSurface(out, *this, outputFactorOrder, options);
+// }
+
+// //////////////////////////////////////////////////////////////////////////
+// /***
+// * print surface factor only for the given phrase
+// */
+// void
+// Hypothesis::
+// OutputSurface(std::ostream &out, const Hypothesis &edge,
+// const std::vector<FactorType> &outputFactorOrder,
+// const ReportingOptions &options) const
+// {
+// UTIL_THROW_IF2(outputFactorOrder.size() == 0,
+// "Must specific at least 1 output factor");
+// const TargetPhrase& phrase = edge.GetCurrTargetPhrase();
+// // TODO: slay the rest of StaticData here and move stuff into ReportingOptions
+// bool markUnknown = GetManager().options().unk.mark;
+// bool featureLabels = StaticData::Instance().options().nbest.include_feature_labels;
+// if (options.ReportAllFactors == true) {
+// out << phrase;
+// } else {
+// FactorType placeholderFactor
+// = StaticData::Instance().options().input.placeholder_factor;
+
+// std::map<size_t, const Factor*> placeholders;
+// if (placeholderFactor != NOT_FOUND) {
+// // creates map of target position -> factor for placeholders
+// placeholders = GetPlaceholders(edge, placeholderFactor);
+// }
+
+// size_t size = phrase.GetSize();
+// for (size_t pos = 0 ; pos < size ; pos++) {
+// const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[0]);
+
+// if (placeholders.size()) {
+// // do placeholders
+// std::map<size_t, const Factor*>::const_iterator iter = placeholders.find(pos);
+// if (iter != placeholders.end()) {
+// factor = iter->second;
+// }
+// }
+
+// UTIL_THROW_IF2(factor == NULL,
+// "No factor 0 at position " << pos);
+
+// //preface surface form with UNK if marking unknowns
+// const Word &word = phrase.GetWord(pos);
+// if(markUnknown && word.IsOOV()) {
+// out << GetManager().options().unk.prefix << *factor
+// << GetManager().options().unk.suffix;
+// } else {
+// out << *factor;
+// }
+
+// for (size_t i = 1 ; i < outputFactorOrder.size() ; i++) {
+// const Factor *factor = phrase.GetFactor(pos, outputFactorOrder[i]);
+// UTIL_THROW_IF2(factor == NULL,
+// "No factor " << i << " at position " << pos);
+
+// out << "|" << *factor;
+// }
+// out << " ";
+// }
+// }
+
+// // trace ("report segmentation") option "-t" / "-tt"
+// if (options.ReportSegmentation > 0 && phrase.GetSize() > 0) {
+// const Range &sourceRange = edge.GetCurrSourceWordsRange();
+// const int sourceStart = sourceRange.GetStartPos();
+// const int sourceEnd = sourceRange.GetEndPos();
+// out << "|" << sourceStart << "-" << sourceEnd; // enriched "-tt"
+// if (options.ReportSegmentation == 2) {
+// out << ",wa=";
+// edge.OutputAlignment(out, false);
+// // const AlignmentInfo &ai = edge.GetCurrTargetPhrase().GetAlignTerm();
+// // Hypothesis::OutputAlignment(out, ai, 0, 0, options.WA_SortOrder);
+// out << ",total=";
+// out << edge.GetScore() - edge.GetPrevHypo()->GetScore();
+// out << ",";
+// ScoreComponentCollection scoreBreakdown(edge.GetScoreBreakdown());
+// scoreBreakdown.MinusEquals(edge.GetPrevHypo()->GetScoreBreakdown());
+// scoreBreakdown.OutputAllFeatureScores(out, featureLabels);
+// }
+// out << "| ";
+// }
+// }
std::map<size_t, const Factor*>
Hypothesis::