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:
authorHieu Hoang <hieuhoang@gmail.com>2012-11-12 23:56:18 +0400
committerHieu Hoang <hieuhoang@gmail.com>2012-11-12 23:56:18 +0400
commit5e3ef23cef6101d2c098eb3445f562e8f595655b (patch)
treeb8c332b6fa82bae84ea4910967a10ba1b08a7107 /moses/HypothesisStack.h
parent8c785cff2b1be3cccd76ea9026f71b649762dfc3 (diff)
move moses/src/* to moses/
Diffstat (limited to 'moses/HypothesisStack.h')
-rw-r--r--moses/HypothesisStack.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/moses/HypothesisStack.h b/moses/HypothesisStack.h
new file mode 100644
index 000000000..26e6ed21b
--- /dev/null
+++ b/moses/HypothesisStack.h
@@ -0,0 +1,63 @@
+#ifndef moses_HypothesisStack_h
+#define moses_HypothesisStack_h
+
+#include <vector>
+#include <set>
+#include "Hypothesis.h"
+#include "WordsBitmap.h"
+
+namespace Moses
+{
+
+class Manager;
+
+/** abstract unique set of hypotheses that cover a certain number of words,
+ * ie. a stack in phrase-based decoding
+ */
+class HypothesisStack
+{
+
+protected:
+ typedef std::set< Hypothesis*, HypothesisRecombinationOrderer > _HCType;
+ _HCType m_hypos; /**< contains hypotheses */
+ Manager& m_manager;
+
+public:
+ HypothesisStack(Manager& manager): m_manager(manager) {}
+ typedef _HCType::iterator iterator;
+ typedef _HCType::const_iterator const_iterator;
+ //! iterators
+ const_iterator begin() const {
+ return m_hypos.begin();
+ }
+ const_iterator end() const {
+ return m_hypos.end();
+ }
+ size_t size() const {
+ return m_hypos.size();
+ }
+ virtual inline float GetWorstScore() const {
+ return -std::numeric_limits<float>::infinity();
+ };
+ virtual float GetWorstScoreForBitmap( WordsBitmapID ) {
+ return -std::numeric_limits<float>::infinity();
+ };
+ virtual float GetWorstScoreForBitmap( const WordsBitmap& ) {
+ return -std::numeric_limits<float>::infinity();
+ };
+
+ virtual ~HypothesisStack();
+ virtual bool AddPrune(Hypothesis *hypothesis) = 0;
+ virtual const Hypothesis *GetBestHypothesis() const = 0;
+ virtual std::vector<const Hypothesis*> GetSortedList() const = 0;
+
+ //! remove hypothesis pointed to by iterator but don't delete the object
+ virtual void Detach(const HypothesisStack::iterator &iter);
+ /** destroy Hypothesis pointed to by iterator (object pool version) */
+ virtual void Remove(const HypothesisStack::iterator &iter);
+
+};
+
+}
+
+#endif