summaryrefslogtreecommitdiff
path: root/realtime/mkinput.py
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-30 16:00:12 -0700
committerMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-30 16:00:12 -0700
commit3cc87778e8985ff7e1bcf3a4a12d071c2ddd5639 (patch)
treec860fbdf22c1ef0b26a8b244af9453db0c8b920e /realtime/mkinput.py
parent046e726aa598c75ca8f5a22a74d83cd2c405b741 (diff)
New commands, save/load context
Diffstat (limited to 'realtime/mkinput.py')
-rwxr-xr-xrealtime/mkinput.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/realtime/mkinput.py b/realtime/mkinput.py
index df434c76..a1b1256d 100755
--- a/realtime/mkinput.py
+++ b/realtime/mkinput.py
@@ -5,13 +5,14 @@ import sys
def main():
- if len(sys.argv[1:]) != 2:
- sys.stderr.write('usage: {} test.src test.ref >test.input\n'.format(sys.argv[0]))
+ if len(sys.argv[1:]) < 2:
+ sys.stderr.write('usage: {} test.src test.ref [ctx_name] >test.input\n'.format(sys.argv[0]))
sys.exit(2)
+ ctx_name = ' {}'.format(sys.argv[3]) if len(sys.argv[1:]) > 2 else ''
for (src, ref) in itertools.izip(open(sys.argv[1]), open(sys.argv[2])):
- sys.stdout.write('TR ||| {}'.format(src))
- sys.stdout.write('LEARN ||| {} ||| {}'.format(src.strip(), ref))
+ sys.stdout.write('TR{} ||| {}'.format(ctx_name, src))
+ sys.stdout.write('LEARN{} ||| {} ||| {}'.format(ctx_name, src.strip(), ref))
if __name__ == '__main__':
main()