summaryrefslogtreecommitdiff
path: root/dtrain/kbestget.h
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2011-09-26 18:24:58 +0200
committerPatrick Simianer <p@simianer.de>2011-09-26 18:24:58 +0200
commite16b311246f9f2c309b257debd5f50a28b04802b (patch)
treeae8cbb64cd710d92614af5ad81a83cccaaa9c32e /dtrain/kbestget.h
parent044e1f2f7a074d9940c30eee7b800beb070c706d (diff)
score refactoring #1
Diffstat (limited to 'dtrain/kbestget.h')
-rw-r--r--dtrain/kbestget.h20
1 files changed, 18 insertions, 2 deletions
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 <vector>
+#include <string>
+
+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<double> f;
score_t model;
score_t score;
+ unsigned rank;
};
struct HypSampler : public DecoderObserver
{
- virtual vector<ScoredHyp>* GetSamples() {}
+ virtual vector<ScoredHyp>* 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);
}
}