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
commit08be69abb923b74f7dc27712d6bef7f6e4a05377 (patch)
tree451919fb2311b22ab650ab6badd9dede6016c646 /training/mira
parent15084a749ee241b261458898640ac43a459acb59 (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