summaryrefslogtreecommitdiff
path: root/python/cdec
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2015-06-24 20:35:41 +0200
committerPatrick Simianer <p@simianer.de>2015-06-24 20:35:41 +0200
commit01d50b20817f606108968e0cd4898f5883fa414e (patch)
tree3b9bb0f7b1a6e92e569a9c7ef3b43bf18553aa65 /python/cdec
parent22ea76bc189f866e716d4d8a8755151714198ec8 (diff)
cdec.sa: cleanup
Diffstat (limited to 'python/cdec')
-rw-r--r--python/cdec/sa/extract.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/cdec/sa/extract.py b/python/cdec/sa/extract.py
index cf87ff77..37234e9e 100644
--- a/python/cdec/sa/extract.py
+++ b/python/cdec/sa/extract.py
@@ -103,12 +103,12 @@ def stream_extract2(url):
from nanomsg import Socket, PAIR, PUB
socket = nanomsg.Socket(nanomsg.PAIR)
socket.bind(url)
- sys.stderr.write("sending hello ...\n")
+ sys.stderr.write("[extractor] sending hello ...\n")
socket.send("hello")
while True:
line = socket.recv()
if line.strip() == "shutdown":
- sys.stderr.write("shutting down\n")
+ sys.stderr.write("[extractor] shutting down\n")
break
if not line:
break
@@ -119,9 +119,9 @@ def stream_extract2(url):
if cmd.lower() == 'drop':
if online:
extractor.drop_ctx(context)
- sock.send('drop {}'.format(context))
+ sock.send('[extractor] drop {}'.format(context))
else:
- sock.send('Error: online mode not set. Skipping line: {}'.format(line.strip()))
+ sock.send('[extractor] Error: online mode not set. Skipping line: {}'.format(line.strip()))
# context ||| sentence ||| grammar_file
elif len(fields) == 3:
(context, sentence, grammar_file) = fields
@@ -133,9 +133,9 @@ def stream_extract2(url):
elif len(fields) == 4:
(context, sentence, reference, alignment) = fields
extractor.add_instance(sentence, reference, alignment, context)
- socket.send('learn {}'.format(context))
+ socket.send('[extractor] learn (context: {})'.format(context))
else:
- socket.send('Error: see README.md for stream mode usage. Skipping line: {}'.format(line.strip()))
+ socket.send('[extractor] Error: see README.md for stream mode usage. Skipping line: {}'.format(line.strip()))
socket.send("off")
socket.close()