From d18024a41cbc1b54db88d499571349a6234b6db8 Mon Sep 17 00:00:00 2001
From: Patrick Simianer
Date: Mon, 29 Apr 2013 15:24:39 +0200
Subject: fix, cleaned up headers
---
training/dtrain/kbestget.h | 66 +---------------------------------------------
1 file changed, 1 insertion(+), 65 deletions(-)
(limited to 'training/dtrain/kbestget.h')
diff --git a/training/dtrain/kbestget.h b/training/dtrain/kbestget.h
index dd8882e1..85252db3 100644
--- a/training/dtrain/kbestget.h
+++ b/training/dtrain/kbestget.h
@@ -1,76 +1,12 @@
#ifndef _DTRAIN_KBESTGET_H_
#define _DTRAIN_KBESTGET_H_
-#include "kbest.h" // cdec
-#include "sentence_metadata.h"
-
-#include "verbose.h"
-#include "viterbi.h"
-#include "ff_register.h"
-#include "decoder.h"
-#include "weights.h"
-#include "logval.h"
-
-using namespace std;
+#include "kbest.h"
namespace dtrain
{
-typedef double score_t;
-
-struct ScoredHyp
-{
- vector w;
- SparseVector f;
- score_t model;
- score_t score;
- unsigned rank;
-};
-
-struct LocalScorer
-{
- unsigned N_;
- vector w_;
-
- virtual score_t
- Score(vector& hyp, vector& ref, const unsigned rank, const unsigned src_len)=0;
-
- void Reset() {} // only for approx bleu
-
- inline void
- Init(unsigned N, vector weights)
- {
- assert(N > 0);
- N_ = N;
- if (weights.empty()) for (unsigned i = 0; i < N_; i++) w_.push_back(1./N_);
- else w_ = weights;
- }
-
- inline score_t
- brevity_penalty(const unsigned hyp_len, const unsigned ref_len)
- {
- if (hyp_len > ref_len) return 1;
- return exp(1 - (score_t)ref_len/hyp_len);
- }
-};
-
-struct HypSampler : public DecoderObserver
-{
- LocalScorer* scorer_;
- vector* ref_;
- unsigned f_count_, sz_;
- virtual vector* GetSamples()=0;
- inline void SetScorer(LocalScorer* scorer) { scorer_ = scorer; }
- inline void SetRef(vector& ref) { ref_ = &ref; }
- inline unsigned get_f_count() { return f_count_; }
- inline unsigned get_sz() { return sz_; }
-};
-////////////////////////////////////////////////////////////////////////////////
-
-
-
-
struct KBestGetter : public HypSampler
{
const unsigned k_;
--
cgit v1.2.3