From a433961e78a958d25a6d708bfd89e9655d1217c7 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 26 Sep 2011 18:24:58 +0200
Subject: score refactoring #1
---
dtrain/kbestget.h | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
(limited to 'dtrain/kbestget.h')
diff --git a/dtrain/kbestget.h b/dtrain/kbestget.h
index 935998a0..2a2c6073 100644
--- a/dtrain/kbestget.h
+++ b/dtrain/kbestget.h
@@ -1,11 +1,24 @@
#ifndef _DTRAIN_KBESTGET_H_
#define _DTRAIN_KBESTGET_H_
-#include "kbest.h"
+
+#include
+#include
+
+using namespace std;
+
+#include "kbest.h" // cdec
+#include "verbose.h"
+#include "viterbi.h"
+#include "ff_register.h"
+#include "decoder.h"
+#include "weights.h"
namespace dtrain
{
+typedef double score_t; // float
+
struct ScoredHyp
{
@@ -13,11 +26,12 @@ struct ScoredHyp
SparseVector f;
score_t model;
score_t score;
+ unsigned rank;
};
struct HypSampler : public DecoderObserver
{
- virtual vector* GetSamples() {}
+ virtual vector* GetSamples()=0;
};
struct KBestGetter : public HypSampler
@@ -62,6 +76,7 @@ struct KBestGetter : public HypSampler
h.w = d->yield;
h.f = d->feature_values;
h.model = log(d->score);
+ h.rank = i;
s_.push_back(h);
}
}
@@ -79,6 +94,7 @@ struct KBestGetter : public HypSampler
h.w = d->yield;
h.f = d->feature_values;
h.model = log(d->score);
+ h.rank = i;
s_.push_back(h);
}
}
--
cgit v1.2.3