diff options
author | Patrick Simianer <p@simianer.de> | 2013-11-13 18:12:10 +0100 |
---|---|---|
committer | Patrick Simianer <p@simianer.de> | 2013-11-13 18:12:10 +0100 |
commit | d6e6babf2cfe49fed040b651624b7e34d1a9b507 (patch) | |
tree | 2a00ab18f10a7f93e7e172551c01b48cc9f20b8c /realtime/mkinput.py | |
parent | 2d2d5eced93d58bc77894d8c328195cd9950b96d (diff) | |
parent | 8a24bb77bc2e9fd17a6f6529a2942cde96a6af49 (diff) |
merge w/ upstream
Diffstat (limited to 'realtime/mkinput.py')
-rwxr-xr-x | realtime/mkinput.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/realtime/mkinput.py b/realtime/mkinput.py new file mode 100755 index 00000000..a1b1256d --- /dev/null +++ b/realtime/mkinput.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python + +import itertools +import sys + +def main(): + + 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(ctx_name, src)) + sys.stdout.write('LEARN{} ||| {} ||| {}'.format(ctx_name, src.strip(), ref)) + +if __name__ == '__main__': + main() |