diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-06-19 16:46:52 +0100 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-06-19 16:46:52 +0100 |
commit | 22e6ab01aebca3e9012b07f9600153c7b593996e (patch) | |
tree | 844d1a650a302114ae619d37b8778ab66207a834 /word-aligner/ttables.cc | |
parent | 02099a01350a41a99ec400e9b29df08a01d88979 (diff) | |
parent | 0dc7755f7fb1ef15db5a60c70866aa61b6367898 (diff) |
Merge branch 'master' of https://github.com/redpony/cdec
Diffstat (limited to 'word-aligner/ttables.cc')
-rw-r--r-- | word-aligner/ttables.cc | 14 |
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"); } |