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:
authorKenneth Heafield <github@kheafield.com>2012-11-16 18:46:10 +0400
committerKenneth Heafield <github@kheafield.com>2012-11-16 19:53:43 +0400
commit2df57b6b092b6e713814ab5c19fdc7d0525fb945 (patch)
treecc39cbf6a106d0fb098a61c0d1eb5f6493c38910 /moses/Incremental.h
parent6a3fdcd8c043148769736d113562fc8c92e917ca (diff)
Expose k-best lists from incremental search
Diffstat (limited to 'moses/Incremental.h')
-rw-r--r--moses/Incremental.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/moses/Incremental.h b/moses/Incremental.h
index 9661ec021..4bfc2dae3 100644
--- a/moses/Incremental.h
+++ b/moses/Incremental.h
@@ -1,6 +1,8 @@
#pragma once
#include "lm/word_index.hh"
+#include "search/applied.hh"
+#include "search/nbest.hh"
#include "moses/ChartCellCollection.h"
#include "moses/ChartParser.h"
@@ -9,6 +11,7 @@
#include <string>
namespace Moses {
+class ScoreComponentCollection;
class InputType;
class TranslationSystem;
namespace Incremental {
@@ -21,18 +24,37 @@ class Manager {
template <class Model> void LMCallback(const Model &model, const std::vector<lm::WordIndex> &words);
- void ProcessSentence();
+ const std::vector<search::Applied> &ProcessSentence();
- const std::string &String() const { return output_; }
+ // Call to get the same value as ProcessSentence returned.
+ const std::vector<search::Applied> &Completed() const {
+ return *completed_nbest_;
+ }
private:
+ template <class Model, class Best> search::History PopulateBest(const Model &model, const std::vector<lm::WordIndex> &words, Best &out);
+
const InputType &source_;
const TranslationSystem &system_;
ChartCellCollectionBase cells_;
ChartParser parser_;
- std::string output_;
+ // Only one of single_best_ or n_best_ will be used, but it was easier to do this than a template.
+ search::SingleBest single_best_;
+ // ProcessSentence returns a reference to a vector. ProcessSentence
+ // doesn't have one, so this is populated and returned.
+ std::vector<search::Applied> backing_for_single_;
+
+ search::NBest n_best_;
+
+ const std::vector<search::Applied> *completed_nbest_;
};
+
+// Just get the phrase.
+void ToPhrase(const search::Applied final, Phrase &out);
+// Get the phrase and the features.
+void PhraseAndFeatures(const TranslationSystem &system, const search::Applied final, Phrase &phrase, ScoreComponentCollection &features);
+
} // namespace Incremental
} // namespace Moses