<commit_before>package main

import (
	"fmt"
	"time"

	"code.google.com/p/go.exp/fsnotify"
	"github.com/hishboy/gocommons/lang"
)

type Event struct {
	Name      string
	FilePath  string
	EventType int
	EventTime time.Time
}

func PackageEvent(event *fsnotify.FileEvent) Event {
	eventType := func() int {
		switch {
		case event.IsCreate():
			return 1
		case event.IsModify():
			return 2
		case event.IsDelete():
			return 4
		case event.IsRename():
			return 8
		}
		return 1
	}()

	//fmt.Println("EVENTTTTT: ", event)

	return Event{
		event.Name,
		event.Name,
		eventType,
		time.Now(),
	}

}

func EventHandler(eventQueue *lang.Queue) {
	fmt.Println("In event handler")
	for {

		// Events put into the queue lose most of their info.
		// Before pushing onto the queue must make own new<commit_msg>Now use regexp on FileEvent to get file name and the containing path.<commit_after>package main

import (
	"fmt"
	"regexp"
	"time"

	"code.google.com/p/go.exp/fsnotify"
	"github.com/hishboy/gocommons/lang"
)

type Event struct {
	Name      string
	FilePath  string
	EventType int
	EventTime time.Time
}

func PackageEvent(event *fsnotify.FileEvent) Event {
	eventType := func() int {
		switch {
		case event.IsCreate():
			return 1
		case event.IsModify():
			return 2
		case event.IsDelete():
			return 4
		case event.IsRename():
			return 8
		}
		return 1
	}()

	//var name string
	//var path string

	re, err := regexp.Compile("(.+/)/(.+)")
	if err != nil {
		fmt.Println("Problem compiling regexp")
	}
	result := re.FindStringSubmatch(event.Name)

	return Event{
		result[2],
		result[1],
		eventType,
		time.Now(),
	}
}

func EventHandler(eventQueue *lang.Queue) {
	fmt.Println("In event handler")
	for {

		// Events put into the queue lose most of their info.
		// Before pushing onto the queue must make own new
{'fraction_non_alphanumeric': 0.1210958904109589, 'fraction_numerical': 0.006575342465753425, 'mean_word_length': 3.2366589327146174, 'pattern_counts': {'":': 0, '<': 3, '<?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': '755167', 'n_tokens_mistral': 710, 'n_tokens_neox': 640, 'n_words': 183}