summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--python/cdec/sa/extract.py12
-rwxr-xr-xpython/feed_extract.rb23
2 files changed, 6 insertions, 29 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()
diff --git a/python/feed_extract.rb b/python/feed_extract.rb
deleted file mode 100755
index c1390522..00000000
--- a/python/feed_extract.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'nanomsg'
-
-port = 8888
-sock = NanoMsg::PairSocket.new
-addr = "tcp://127.0.0.1:#{port}"
-#addr = "ipc:///tmp/network_decoder.ipc"
-sock.connect addr
-
-while true
- line = STDIN.gets
- if !line || line.strip=='shutdown'
- puts "shutting down"
- sock.send 'shutdown'
- break
- end
- puts "sending '#{line.strip}'"
- sock.send line.strip
- sleep 1
- puts "got alignment: #{sock.recv}\n\n"
-end
-