<commit_before>package main

import (
	"os"

	"github.com/nsf/termbox-go"
)

type Lesser struct {
	file *os.File
}

func (l Lesser) Run() {
	for {
		e := termbox.PollEvent()
		switch e.Type {
		case termbox.EventKey:
			switch e.Ch {
			case 'q':
				return
			}
		}
	}
}

func NewLesser(f *os.File) Lesser {
	return Lesser{file: f}
}<commit_msg>Create a channel of Lesser events<commit_after>package main

import (
	"os"

	"github.com/nsf/termbox-go"
)

type Event int

const (
	EventQuit Event = iota
)

type Lesser struct {
	file *os.File

	events chan Event
}

func (l Lesser) listenEvents() {
	for {
		e := termbox.PollEvent()
		switch e.Type {
		case termbox.EventKey:
			switch e.Ch {
			case 'q':
				l.events <- EventQuit
			}
		}
	}
}

func (l Lesser) Run() {
	go l.listenEvents()

	select {
	case e := <-l.events:
		switch e {
		case EventQuit:
			return
		}
	}
}

func NewLesser(f *os.File) Lesser {
	return Lesser{
		file:   f,
		events: make(chan Event, 1),
	}
}
{'fraction_non_alphanumeric': 0.13524590163934427, 'fraction_numerical': 0.0010245901639344263, 'mean_word_length': 2.772200772200772, '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': '1935016', 'n_tokens_mistral': 441, 'n_tokens_neox': 398, 'n_words': 102}