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 'contrib/moses2/PhraseBased/CubePruningMiniStack/Stack.h')
-rw-r--r--contrib/moses2/PhraseBased/CubePruningMiniStack/Stack.h77
1 files changed, 77 insertions, 0 deletions
diff --git a/contrib/moses2/PhraseBased/CubePruningMiniStack/Stack.h b/contrib/moses2/PhraseBased/CubePruningMiniStack/Stack.h
new file mode 100644
index 000000000..7601f90b2
--- /dev/null
+++ b/contrib/moses2/PhraseBased/CubePruningMiniStack/Stack.h
@@ -0,0 +1,77 @@
+/*
+ * Stack.h
+ *
+ * Created on: 24 Oct 2015
+ * Author: hieu
+ */
+#pragma once
+#include <boost/unordered_map.hpp>
+#include <boost/unordered_set.hpp>
+#include <deque>
+#include "../Hypothesis.h"
+#include "../../TypeDef.h"
+#include "../../Vector.h"
+#include "../../MemPool.h"
+#include "../../MemPoolAllocator.h"
+#include "../../Recycler.h"
+#include "../../HypothesisColl.h"
+#include "../../legacy/Util2.h"
+
+namespace Moses2
+{
+
+class Manager;
+class HypothesisBase;
+class ArcLists;
+
+namespace NSCubePruningMiniStack
+{
+
+class Stack
+{
+protected:
+
+public:
+ typedef std::pair<const Bitmap*, size_t> HypoCoverage;
+ // bitmap and current endPos of hypos
+
+ typedef boost::unordered_map<HypoCoverage, Moses2::HypothesisColl*,
+ boost::hash<HypoCoverage>, std::equal_to<HypoCoverage>,
+ MemPoolAllocator<std::pair<HypoCoverage, Moses2::HypothesisColl*> > > Coll;
+
+ Stack(const Manager &mgr);
+ virtual ~Stack();
+
+ size_t GetHypoSize() const;
+
+ Coll &GetColl()
+ {
+ return m_coll;
+ }
+ const Coll &GetColl() const
+ {
+ return m_coll;
+ }
+
+ void Add(Hypothesis *hypo, Recycler<HypothesisBase*> &hypoRecycle,
+ ArcLists &arcLists);
+
+ Moses2::HypothesisColl &GetMiniStack(const HypoCoverage &key);
+
+ const Hypothesis *GetBestHypo() const;
+ void Clear();
+
+ void DebugCounts();
+
+protected:
+ const Manager &m_mgr;
+ Coll m_coll;
+
+ std::deque<Moses2::HypothesisColl*, MemPoolAllocator<Moses2::HypothesisColl*> > m_miniStackRecycler;
+
+};
+
+}
+
+}
+