summaryrefslogtreecommitdiff
path: root/word-aligner/feed.rb
blob: 6aa80d95be19960f1eb5f1d6dfe4e4b782e39917 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby

require 'nanomsg'

port = 60666
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