Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-12-28 23:32:26 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-12-28 23:32:26 +0300
commit6a8b43cf010e527e605c90e22926ca8f48e7125f (patch)
tree82277e9959eb12644b10fa09b4d3c4688318b810 /misc
parent1de4921d2acf2322c6d16db7773aa7ae8ab476b5 (diff)
add Lex RO as probabilities, not scores
Diffstat (limited to 'misc')
-rw-r--r--misc/addLexROtoPT.cpp19
1 files changed, 12 insertions, 7 deletions
diff --git a/misc/addLexROtoPT.cpp b/misc/addLexROtoPT.cpp
index d0eb54ec4..a03fd579e 100644
--- a/misc/addLexROtoPT.cpp
+++ b/misc/addLexROtoPT.cpp
@@ -86,7 +86,7 @@ std::vector<float>
GetScore(const std::string& f, const std::string& e, const std::string& c)
{
std::string key;
- std::vector<float> scores;
+ std::vector<float> probs;
key = MakeKey(f, e, c);
@@ -100,14 +100,19 @@ GetScore(const std::string& f, const std::string& e, const std::string& c)
BitWrapper<> bitStream(scoresString);
- for(size_t i = 0; i < m_numScoreComponent; i++)
- scores.push_back(m_scoreTrees[m_multipleScoreTrees ? i : 0]->Read(bitStream));
+ for(size_t i = 0; i < m_numScoreComponent; i++) {
+ float prob = m_scoreTrees[m_multipleScoreTrees ? i : 0]->Read(bitStream);
+ prob = exp(prob);
+ probs.push_back(prob);
+ }
- return scores;
+ return probs;
}
+ else {
+ // return empty vector;
+ }
- return std::vector<float>();
-
+ return probs;
}
////////////////////////////////////////////////////////////////////////////////////
@@ -153,7 +158,7 @@ int main(int argc, char** argv)
}
// output
- for (size_t i = 0; i < toks.size() - 1; ++i) {
+ for (size_t i = 0; i < columns.size() - 1; ++i) {
cout << columns[i] << " ||| ";
}
cout << columns[columns.size() - 1] << endl;