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
commit0dc7755f7fb1ef15db5a60c70866aa61b6367898 (patch)
tree087d7447ee074752b7a72caf4468f35b32f4d3df /word-aligner/ttables.cc
parent8dc383a74c12d44ab3f51947575ed5828653f4f1 (diff)
parent06d8693e48d83a0f717fce3b18bf73f1d49a5294 (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");
}