diff options
author | Rico Sennrich <rico.sennrich@gmx.ch> | 2014-09-16 19:36:45 +0400 |
---|---|---|
committer | Rico Sennrich <rico.sennrich@gmx.ch> | 2014-09-22 13:49:20 +0400 |
commit | 6810b225ccd673c7684ab9b62e0daa0a7af054f3 (patch) | |
tree | 570de70e3e57af2bc13782c09e222599c7b26e5d /mert/CderScorer.cpp | |
parent | f40bb2c53c2dcd832bde9e987c921171e2d1e581 (diff) |
calculateScore with float (for smoothing support)
Diffstat (limited to 'mert/CderScorer.cpp')
-rw-r--r-- | mert/CderScorer.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mert/CderScorer.cpp b/mert/CderScorer.cpp index f06700abf..4479e0ad8 100644 --- a/mert/CderScorer.cpp +++ b/mert/CderScorer.cpp @@ -52,18 +52,18 @@ void CderScorer::prepareStats(size_t sid, const string& text, ScoreStats& entry) { string sentence = this->preprocessSentence(text); - vector<int> stats; + vector<ScoreStatsType> stats; prepareStatsVector(sid, sentence, stats); entry.set(stats); } -void CderScorer::prepareStatsVector(size_t sid, const string& text, vector<int>& stats) +void CderScorer::prepareStatsVector(size_t sid, const string& text, vector<ScoreStatsType>& stats) { sent_t cand; TokenizeAndEncode(text, cand); float max = -2; - vector<int> tmp; + vector<ScoreStatsType> tmp; for (size_t rid = 0; rid < m_ref_sentences.size(); ++rid) { const sent_t& ref = m_ref_sentences[rid][sid]; tmp.clear(); @@ -79,7 +79,7 @@ void CderScorer::prepareStatsVector(size_t sid, const string& text, vector<int>& } } -float CderScorer::calculateScore(const vector<int>& comps) const +float CderScorer::calculateScore(const vector<ScoreStatsType>& comps) const { if (comps.size() != 2) { throw runtime_error("Size of stat vector for CDER is not 2"); @@ -89,7 +89,7 @@ float CderScorer::calculateScore(const vector<int>& comps) const } void CderScorer::computeCD(const sent_t& cand, const sent_t& ref, - vector<int>& stats) const + vector<ScoreStatsType>& stats) const { int I = cand.size() + 1; // Number of inter-words positions in candidate sentence int L = ref.size() + 1; // Number of inter-words positions in reference sentence |