<commit_before>#!/usr/bin/env ruby

require 'serialport'
require 'ted/recorder'

sp = SerialPort.new ARGV[0], 1200


while true do
  begin
    byte = sp.readbyte
  end until !byte.nil? && 0xaa == byte

  bytes = [byte]
  10.times do
    bytes << sp.readbyte
  end

  message = Ted::Recorder::Ted1000Message.new(bytes.pack('C*'))
  puts message.inspect if message.verify?

  #while true do print "%02x" % ~(sp.readbyte) end<commit_msg>A little tweak here and there<commit_after>#!/usr/bin/env ruby

require 'serialport'
require 'ted/recorder'

sp = SerialPort.new ARGV[0], 1200


while true do
  begin
    byte = sp.read(1)
  end until ["aa"] == byte.unpack('H*')

  bytes = "#{byte}#{sp.read(10)}"
  puts bytes.unpack('H*')

  message = Ted::Recorder::Ted1000Message.new(bytes)
  puts message.inspect if message.verify?

{'fraction_non_alphanumeric': 0.15, 'fraction_numerical': 0.03170731707317073, 'mean_word_length': 3.886904761904762, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '3166623', 'n_tokens_mistral': 330, 'n_tokens_neox': 301, 'n_words': 75}