summaryrefslogtreecommitdiff
path: root/vest/mbr_kbest.cc
diff options
context:
space:
mode:
authorgraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-20 00:11:45 +0000
committergraehl <graehl@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-07-20 00:11:45 +0000
commiteb0a8931eb835d8a23c939ef61867a08c19ebf6b (patch)
tree7112b6af490a04c8bfdc40eb88718702060823c7 /vest/mbr_kbest.cc
parentbcad98e114d468edf16369b3a30d98556a3d0e61 (diff)
Score::TimesEquals for vlad-mira, intrusive refcount for Score, shared_ptr compile fixes for decoder progs
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@331 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'vest/mbr_kbest.cc')
-rw-r--r--vest/mbr_kbest.cc6
1 files changed, 2 insertions, 4 deletions
diff --git a/vest/mbr_kbest.cc b/vest/mbr_kbest.cc
index 5d70b4e2..2867b36b 100644
--- a/vest/mbr_kbest.cc
+++ b/vest/mbr_kbest.cc
@@ -101,14 +101,13 @@ int main(int argc, char** argv) {
for (int i = 0 ; i < list.size(); ++i) {
vector<vector<WordID> > refs(1, list[i].first);
//cerr << i << ": " << list[i].second <<"\t" << TD::GetString(list[i].first) << endl;
- SentenceScorer* scorer = SentenceScorer::CreateSentenceScorer(type, refs);
+ ScorerP scorer = SentenceScorer::CreateSentenceScorer(type, refs);
double wl_acc = 0;
for (int j = 0; j < list.size(); ++j) {
if (i != j) {
- Score* s = scorer->ScoreCandidate(list[j].first);
+ ScoreP s = scorer->ScoreCandidate(list[j].first);
double loss = 1.0 - s->ComputeScore();
if (type == TER || type == AER) loss = 1.0 - loss;
- delete s;
double weighted_loss = loss * (joints[j] / marginal);
wl_acc += weighted_loss;
if ((!output_list) && wl_acc > mbr_loss) break;
@@ -119,7 +118,6 @@ int main(int argc, char** argv) {
mbr_loss = wl_acc;
mbr_idx = i;
}
- delete scorer;
}
// cerr << "ML translation: " << TD::GetString(list[0].first) << endl;
cerr << "MBR Best idx: " << mbr_idx << endl;