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 | 83eb31deb8a2056c098715c8cb29f2498fc213c3 (patch) | |
tree | 14a16a2e2d1b5874643cce155e4b7daaa877d951 /dtrain/kbestget.h | |
parent | cbbee18e49d3ae60e0fbb0f308694b8426620695 (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 ); } } }; |