From a0c40ec491674c8826d7be2fbd46eaaa78ad3ed6 Mon Sep 17 00:00:00 2001 From: Felix Hieber Date: Tue, 18 Jun 2013 10:23:55 -0700 Subject: forced alignment --- word-aligner/ttables.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'word-aligner/ttables.cc') 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"); } -- cgit v1.2.3