diff options
author | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-15 20:32:59 -0700 |
---|---|---|
committer | Michael Denkowski <mdenkows@cs.cmu.edu> | 2013-09-15 20:32:59 -0700 |
commit | 895dfd64ea5599ab16981cbfb538ec5f4073c8c1 (patch) | |
tree | 969ded641a86f3cc9ba07685b5bfccd7a50d9a8c /training | |
parent | 58763340c02ddafa056d0a00a061cecfb33c9c0c (diff) |
Move to using named commands
Diffstat (limited to 'training')
-rw-r--r-- | training/mira/kbest_cut_mira.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/training/mira/kbest_cut_mira.cc b/training/mira/kbest_cut_mira.cc index e4435abb..a9a4aeb6 100644 --- a/training/mira/kbest_cut_mira.cc +++ b/training/mira/kbest_cut_mira.cc @@ -734,10 +734,19 @@ int main(int argc, char** argv) { ViterbiESentence(bobs.hypergraph[0], &trans); cout << TD::GetString(trans) << endl; continue; - // Translate and update (normal MIRA) + // Special command: + // CMD ||| arg1 ||| arg2 ... } else { - ds->update(buf.substr(delim + 5)); - buf = buf.substr(0, delim); + string cmd = buf.substr(0, delim); + buf = buf.substr(delim + 5); + // Translate and update (normal MIRA) + // LEARN ||| source ||| reference + if (cmd == "LEARN") { + delim = buf.find(" ||| "); + ds->update(buf.substr(delim + 5)); + buf = buf.substr(0, delim); + } + // TODO: additional commands } } //TODO: allow batch updating |