<commit_before>#!/usr/bin/env lua
-- This is free and unencumbered software released into the public domain.
--
-- Prototype of the `conrepl` command-line interface.
--
-- Requires: https://luarocks.org/modules/gvvaughan/luaposix
-- $ sudo luarocks install luaposix
--
-- Requires: https://luarocks.org/modules/luarocks/luasocket
-- $ sudo luarocks install luasocket

local signal = require("posix.signal")
local socket = require("socket")

signal.signal(signal.SIGINT, function(signum)
  io.write("\n")
  os.exit(128 + signum)
end)

local sock = socket.udp()
sock:setsockname('*', 0)
sock:setpeername("127.0.0.1", 1984)
sock:settimeout(nil)

while true do
  io.write('> ')
  io.stdout:flush()
  local command = io.read()
  if not command then break end
  sock:send(command)
end
io.write("\n")<commit_msg>Simplified the REPL script by eliminating a dependency.<commit_after>#!/usr/bin/env lua
-- This is free and unencumbered software released into the public domain.
--
-- Prototype of the `conrepl` command-line interface.
--
-- Requires: https://luarocks.org/modules/gvvaughan/luaposix
-- $ sudo luarocks install luaposix

local signal = require('posix.signal')
local socket = require('posix.sys.socket')

signal.signal(signal.SIGINT, function(signum)
  io.write("\n")
  os.exit(128 + signum)
end)

local sock = assert(socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0))
assert(socket.bind(sock, {family = socket.AF_INET, addr = '127.0.0.1', port = 0}))
assert(socket.connect(sock, {family = socket.AF_INET, addr = '127.0.0.1', port = 1984}))

while true do
  io.write("> ")
  io.stdout:flush()
  local command = io.read()
  if not command then break end
  assert(socket.send(sock, command))
end
io.write("\n")
{'fraction_non_alphanumeric': 0.1528588098016336, 'fraction_numerical': 0.020420070011668612, 'mean_word_length': 4.309597523219814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 3, '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': '6668776', 'n_tokens_mistral': 627, 'n_tokens_neox': 597, 'n_words': 148}