<commit_before>package main

import (
	"flag"
	"fmt"
	"github.com/anchor/picolog"
	"github.com/fractalcat/emogo"
	zmq "github.com/pebbe/zmq4"
	"os"
)

var Logger *picolog.Logger

func readFrames(e *emogo.EmokitContext, out chan *emogo.EmokitFrame) {
	for {
		f, err := e.WaitGetFrame()
		if err != nil {
			fmt.Printf("error reading frame: %v", err)
			return
		}
		out <- f
	}
}

func main() {
	listen := flag.String("listen", "tcp://*:9424", "ZMQ URI to listen on.")
	flag.Parse()
	Logger = picolog.NewLogger(picolog.LogDebug, "insenced", os.Stdout)
	eeg, err := emogo.NewEmokitContext()
	if err != nil {
		Logger.Errorf("Could not initialize emokit context: %v", err)
	}
	sock, err := zmq.NewSocket(zmq.PUB)
	if err != nil {
		Logger.Fatalf("Could not create ZMQ socket: %v", err)
	}
	err = sock.Bind(*listen)
	if err != nil {
		Logger.Fatalf("Could not bind to %s: %v", listen, err)
	}
	frameChan := make(chan *emogo.EmokitFrame, 0)
	readFrames(eeg, frameChan)
	for {
		f := <-frameChan
		_, err := sock.SendBytes(f.Raw(), 0)
		if err != nil {
			fmt.Printf("Error sending raw frame: %v", err)
		}
	}
}
<commit_msg>Die if we can't talk to the EEG<commit_after>package main

import (
	"flag"
	"fmt"
	"github.com/anchor/picolog"
	"github.com/fractalcat/emogo"
	zmq "github.com/pebbe/zmq4"
	"os"
)

var Logger *picolog.Logger

func readFrames(e *emogo.EmokitContext, out chan *emogo.EmokitFrame) {
	for {
		f, err := e.WaitGetFrame()
		if err != nil {
			fmt.Printf("error reading frame: %v", err)
			return
		}
		out <- f
	}
}

func main() {
	listen := flag.String("listen", "tcp://*:9424", "ZMQ URI to listen on.")
	flag.Parse()
	Logger = picolog.NewLogger(picolog.LogDebug, "insenced", os.Stdout)
	eeg, err := emogo.NewEmokitContext()
	if err != nil {
		Logger.Fatalf("Could not initialize emokit context: %v", err)
	}
	sock, err := zmq.NewSocket(zmq.PUB)
	if err != nil {
		Logger.Fatalf("Could not create ZMQ socket: %v", err)
	}
	err = sock.Bind(*listen)
	if err != nil {
		Logger.Fatalf("Could not bind to %s: %v", listen, err)
	}
	frameChan := make(chan *emogo.EmokitFrame, 0)
	readFrames(eeg, frameChan)
	for {
		f := <-frameChan
		_, err := sock.SendBytes(f.Raw(), 0)
		if err != nil {
			fmt.Printf("Error sending raw frame: %v", err)
		}
	}
}

{'fraction_non_alphanumeric': 0.16799645390070922, 'fraction_numerical': 0.0062056737588652485, 'mean_word_length': 3.6440329218106995, 'pattern_counts': {'":': 0, '<': 7, '<?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': '7516860', 'n_tokens_mistral': 970, 'n_tokens_neox': 911, 'n_words': 225}