summaryrefslogtreecommitdiff
path: root/word-aligner/ttables.cc
diff options
context:
space:
mode:
authorPaul Baltescu <pauldb89@gmail.com>2013-06-19 16:46:52 +0100
committerPaul Baltescu <pauldb89@gmail.com>2013-06-19 16:46:52 +0100
commit46b533663019404f642fa1621701c066fc57734d (patch)
tree8b9d8072cae6ac024b46196c4712a5f02afc33c0 /word-aligner/ttables.cc
parenta3243017d6b8c46cc3e41f4243311dc3dbc80ab4 (diff)
parentf1ce46ec9b1b8efcc4a91a149454acf03c01db02 (diff)
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'word-aligner/ttables.cc')
-rw-r--r--word-aligner/ttables.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/word-aligner/ttables.cc b/word-aligner/ttables.cc
index 45bf14c5..c177aa30 100644
--- a/word-aligner/ttables.cc
+++ b/word-aligner/ttables.cc
@@ -21,6 +21,20 @@ void TTable::DeserializeProbsFromText(std::istream* in) {
cerr << "Loaded " << c << " translation parameters.\n";
}
+void TTable::DeserializeLogProbsFromText(std::istream* in) {
+ int c = 0;
+ while(*in) {
+ string e;
+ string f;
+ double p;
+ (*in) >> e >> f >> p;
+ if (e.empty()) break;
+ ++c;
+ ttable[TD::Convert(e)][TD::Convert(f)] = exp(p);
+ }
+ cerr << "Loaded " << c << " translation parameters.\n";
+}
+
void TTable::SerializeHelper(string* out, const Word2Word2Double& o) {
assert(!"not implemented");
}