summaryrefslogtreecommitdiff
path: root/word-aligner/ttables.cc
diff options
context:
space:
mode:
authorChris Dyer <redpony@gmail.com>2013-06-18 21:04:07 -0700
committerChris Dyer <redpony@gmail.com>2013-06-18 21:04:07 -0700
commitf1ce46ec9b1b8efcc4a91a149454acf03c01db02 (patch)
treea18fe97c06f725e9c492907351c1c669d73b9c5f /word-aligner/ttables.cc
parent535d4016ec5179cb673b697c2e81500a2097924c (diff)
parenta0c40ec491674c8826d7be2fbd46eaaa78ad3ed6 (diff)
Merge pull request #23 from felleh/upstream
forced alignment for fast_align
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");
}