summaryrefslogtreecommitdiff
path: root/realtime/realtime.py
diff options
context:
space:
mode:
authorMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-30 07:45:06 -0700
committerMichael Denkowski <mdenkows@cs.cmu.edu>2013-09-30 07:45:06 -0700
commite97bb01cc3a0790dc8dc474db2fd204cbd3fe579 (patch)
tree13c65747d4972cdeadaf15cfdc8fd7d6976b9054 /realtime/realtime.py
parentb8116c5c3c7e31a276ff38fc8173eab37f292364 (diff)
Command handling
Diffstat (limited to 'realtime/realtime.py')
-rwxr-xr-xrealtime/realtime.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/realtime/realtime.py b/realtime/realtime.py
index 38da4413..af3a3aba 100755
--- a/realtime/realtime.py
+++ b/realtime/realtime.py
@@ -16,11 +16,9 @@ class Parser(argparse.ArgumentParser):
sys.exit(2)
def handle_line(translator, line, output, ctx_name):
- if '|||' in line:
- translator.command_line(line, ctx_name)
- else:
- hyp = translator.decode(line, ctx_name)
- output.write('{}\n'.format(hyp))
+ res = translator.command_line(line, ctx_name)
+ if res:
+ output.write('{}\n'.format(res))
output.flush()
def test1(translator, input, output, ctx_name):
@@ -83,11 +81,9 @@ def main():
if not line:
break
line = line.strip()
- if '|||' in line:
- translator.command_line(line)
- else:
- hyp = translator.decode(line)
- sys.stdout.write('{}\n'.format(hyp))
+ res = translator.command_line(line)
+ if res:
+ sys.stdout.write('{}\n'.format(res))
sys.stdout.flush()
if __name__ == '__main__':