summaryrefslogtreecommitdiff
path: root/training/mira
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-15 20:32:59 -0700
committerMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-15 20:32:59 -0700
commit895dfd64ea5599ab16981cbfb538ec5f4073c8c1 (patch)
tree969ded641a86f3cc9ba07685b5bfccd7a50d9a8c /training/mira
parent58763340c02ddafa056d0a00a061cecfb33c9c0c (diff)
Move to using named commands
Diffstat (limited to 'training/mira')
-rw-r--r--training/mira/kbest_cut_mira.cc15
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