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-10-15 16:58:33 +0400
committerKenneth Heafield <github@kheafield.com>2012-10-15 16:58:33 +0400
commit0eb98df0fe32a8e31188fa107f789afd73d81ccf (patch)
tree6b2f5bb5a21e132f419da1fa7064f94eb74428e6 /search/edge_generator.hh
parented00315c8cf4c0b0f8ebc535cf676139b25ab087 (diff)
Submodules are evil. Undo it.
Diffstat (limited to 'search/edge_generator.hh')
-rw-r--r--search/edge_generator.hh58
1 files changed, 58 insertions, 0 deletions
diff --git a/search/edge_generator.hh b/search/edge_generator.hh
new file mode 100644
index 000000000..875ccc5ea
--- /dev/null
+++ b/search/edge_generator.hh
@@ -0,0 +1,58 @@
+#ifndef SEARCH_EDGE_GENERATOR__
+#define SEARCH_EDGE_GENERATOR__
+
+#include "search/edge.hh"
+#include "search/note.hh"
+
+#include <boost/pool/pool.hpp>
+#include <boost/unordered_map.hpp>
+
+#include <functional>
+#include <queue>
+
+namespace lm {
+namespace ngram {
+class ChartState;
+} // namespace ngram
+} // namespace lm
+
+namespace search {
+
+template <class Model> class Context;
+
+class VertexGenerator;
+
+struct PartialEdgePointerLess : std::binary_function<const PartialEdge *, const PartialEdge *, bool> {
+ bool operator()(const PartialEdge *first, const PartialEdge *second) const {
+ return *first < *second;
+ }
+};
+
+class EdgeGenerator {
+ public:
+ EdgeGenerator(PartialEdge &root, unsigned char arity, Note note);
+
+ Score TopScore() const {
+ return top_score_;
+ }
+
+ Note GetNote() const {
+ return note_;
+ }
+
+ // Pop. If there's a complete hypothesis, return it. Otherwise return NULL.
+ template <class Model> PartialEdge *Pop(Context<Model> &context, boost::pool<> &partial_edge_pool);
+
+ private:
+ Score top_score_;
+
+ unsigned char arity_;
+
+ typedef std::priority_queue<PartialEdge*, std::vector<PartialEdge*>, PartialEdgePointerLess> Generate;
+ Generate generate_;
+
+ Note note_;
+};
+
+} // namespace search
+#endif // SEARCH_EDGE_GENERATOR__