summaryrefslogtreecommitdiff
path: root/decoder/kbest.h
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-25 07:37:59 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-25 07:37:59 +0000
commit410cc38baef914cdc0841a2e8d5a84098e48be49 (patch)
tree5421cec674a71614544ce2705a37e3badc243d70 /decoder/kbest.h
parentf234fd50ce8a6f8a006b0f770cca5170a55232f9 (diff)
more comprehensible (but untested) edge/node filtering, awesome per-edge debugging streams
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@407 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'decoder/kbest.h')
-rw-r--r--decoder/kbest.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/decoder/kbest.h b/decoder/kbest.h
index 35e79bcc..b6f55502 100644
--- a/decoder/kbest.h
+++ b/decoder/kbest.h
@@ -77,6 +77,24 @@ namespace KBest {
return a->score > b->score;
}
};
+
+ struct EdgeHandle {
+ Derivation const* d;
+ explicit EdgeHandle(Derivation const* d) : d(d) { }
+// operator bool() const { return d->edge; }
+ operator Hypergraph::Edge const* () const { return d->edge; }
+// const Hypergraph::Edge* operator ->() const { return d->edge; }
+ };
+
+// typedef Derivation EdgeHandle; // will cause copying, below but not performance critical; change to actual handle if you want
+ EdgeHandle operator()(int t,int taili,EdgeHandle const& parent) const {
+ return EdgeHandle(nds[t].D[parent.d->j[taili]]);
+ }
+
+ std::string derivation_tree(Derivation const& d,bool indent=true,int show_mask=Hypergraph::SPAN|Hypergraph::RULE,int maxdepth=0x7FFFFFFF,int depth=0) const {
+ return d.edge->derivation_tree(*this,EdgeHandle(&d),indent,show_mask,maxdepth,depth);
+ }
+
struct DerivationUniquenessHash {
size_t operator()(const Derivation* d) const {
size_t x = 5381;