diff options
author | Patrick Simianer <p@simianer.de> | 2011-09-08 00:06:52 +0200 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2011-09-23 19:13:58 +0200 |
commit | 0269777fc54bc554c12107bdd5498f743df2a1ce (patch) | |
tree | 05032f88088c2154b4c0ce815bb176ac49dc9b7e /dtrain/kbestget.h | |
parent | bcf45fc73bd855a3003dee7a8a0b7551eeb0523b (diff) |
a lot of stuff, fast_sparse_vector, perceptron, removed sofia, sample [...]
Diffstat (limited to 'dtrain/kbestget.h')
-rw-r--r-- | dtrain/kbestget.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/dtrain/kbestget.h b/dtrain/kbestget.h index bb430b85..ae4588c9 100644 --- a/dtrain/kbestget.h +++ b/dtrain/kbestget.h @@ -14,7 +14,9 @@ namespace dtrain struct KBestList { vector<SparseVector<double> > feats; vector<vector<WordID> > sents; + vector<double> model_scores; vector<double> scores; + size_t GetSize() { return sents.size(); } }; @@ -52,9 +54,10 @@ struct KBestGetter : public DecoderObserver void KBestUnique( const Hypergraph& forest ) { - kb.scores.clear(); kb.sents.clear(); kb.feats.clear(); + kb.model_scores.clear(); + kb.scores.clear(); KBest::KBestDerivations<vector<WordID>, ESentenceTraversal, KBest::FilterUnique, prob_t, EdgeProb> kbest( forest, k_ ); for ( size_t i = 0; i < k_; ++i ) { const KBest::KBestDerivations<vector<WordID>, ESentenceTraversal, KBest::FilterUnique, prob_t, EdgeProb>::Derivation* d = @@ -62,16 +65,17 @@ struct KBestGetter : public DecoderObserver if (!d) break; kb.sents.push_back( d->yield); kb.feats.push_back( d->feature_values ); - kb.scores.push_back( d->score ); + kb.model_scores.push_back( d->score ); } } void KBestNoFilter( const Hypergraph& forest ) { - kb.scores.clear(); kb.sents.clear(); kb.feats.clear(); + kb.model_scores.clear(); + kb.scores.clear(); KBest::KBestDerivations<vector<WordID>, ESentenceTraversal> kbest( forest, k_ ); for ( size_t i = 0; i < k_; ++i ) { const KBest::KBestDerivations<vector<WordID>, ESentenceTraversal>::Derivation* d = @@ -79,7 +83,7 @@ struct KBestGetter : public DecoderObserver if (!d) break; kb.sents.push_back( d->yield); kb.feats.push_back( d->feature_values ); - kb.scores.push_back( d->score ); + kb.model_scores.push_back( d->score ); } } }; |