<commit_before>#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra/rocketio/linda/client'
$stdout.sync = true

url = ARGV.shift || "http://linda.masuilab.org"
puts "connecting.. #{url}"
linda = Sinatra::RocketIO::Linda::Client.new url
ts = linda.tuplespace["delta"]

say = lambda{
  ts.take ["say"] do |tuple|
    next if tuple.size < 2
    p tuple
    speak = tuple[1].gsub(/[`"'\r\n;]/, '').strip
    system "say #{speak}"
    say.call
  end
}

linda.io.on :connect do
  puts "connect!! <#{session}>"
  say.call
end

loop do
end<commit_msg>update say worker<commit_after>#!/usr/bin/env ruby
require 'rubygems'
require 'sinatra/rocketio/linda/client'
$stdout.sync = true

url = ARGV.shift || "http://linda.masuilab.org"
puts "connecting.. #{url}"
linda = Sinatra::RocketIO::Linda::Client.new url
ts = linda.tuplespace["delta"]

say = lambda{
  ts.take ["say"] do |tuple|
    p tuple
    if tuple.size == 2
      str = tuple[1].gsub(/[`"'\r\n;]/, '').strip # sanitize
      system "say #{str}"
      ts.write ["say", str, "success"]
    end
    say.call ## recursive call
  end
}

linda.io.on :connect do  ## RocketIO's "connect" event
  puts "connect!! <#{session}>"
  say.call
end

loop do
end
{'fraction_non_alphanumeric': 0.1834862385321101, 'fraction_numerical': 0.003336113427856547, 'mean_word_length': 3.4776119402985075, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1019113', 'n_tokens_mistral': 475, 'n_tokens_neox': 469, 'n_words': 111}