diff options
author | Patrick Simianer <p@simianer.de> | 2014-07-20 15:08:12 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2014-07-20 15:08:12 +0200 |
commit | 08e9a6f71c80fc7327d1758312b40bd5ba763dc9 (patch) | |
tree | 93a027bbb3e34fd60cc8e5d030a443a7f665389f /fast/hypergraph.hh | |
parent | f219bab21c07d02e7e54d557e23387bd93c9ce5f (diff) |
a lot
Diffstat (limited to 'fast/hypergraph.hh')
-rw-r--r-- | fast/hypergraph.hh | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/fast/hypergraph.hh b/fast/hypergraph.hh index 2e30911..530fbe6 100644 --- a/fast/hypergraph.hh +++ b/fast/hypergraph.hh @@ -1,7 +1,5 @@ #pragma once -#include "grammar.hh" -#include "semiring.hh" #include <iostream> #include <string> #include <sstream> @@ -12,17 +10,19 @@ #include <algorithm> #include <iterator> #include <fstream> +#include <msgpack.hpp> +#include "grammar.hh" +#include "semiring.hh" #include "dummyvector.h" -#include <msgpack.hpp> using namespace std; typedef double score_t; typedef double weight_t; -namespace Hg { +namespace Hg { struct Node; @@ -31,11 +31,11 @@ struct Edge { vector<Node*> tails; score_t score; string rule; //FIXME - DummyVector f; //FIXME + DummyVector f; //FIXME unsigned int arity; - unsigned int mark; + unsigned int mark = 0; - bool is_marked(); + inline bool is_marked() { return mark >= arity; } friend std::ostream& operator<<(std::ostream& os, const Edge& s); size_t head_id_; @@ -47,19 +47,17 @@ struct Edge { struct Node { size_t id; string symbol; - unsigned short left; - unsigned short right; + short left; + short right; score_t score; vector<Edge*> incoming; vector<Edge*> outgoing; unsigned int mark; - bool is_marked(); + inline bool is_marked() { return mark >= incoming.size(); }; friend std::ostream& operator<<(std::ostream& os, const Node& n); - vector<size_t> incoming_ids_; // edge ids - vector<size_t> outgoing_ids_; // edge ids - MSGPACK_DEFINE(id, symbol, left, right, score, incoming_ids_, outgoing_ids_); + MSGPACK_DEFINE(id, symbol, left, right, score); }; struct Hypergraph { @@ -96,6 +94,5 @@ manual(Hypergraph& hg); } // namespace - } // namespace |