<commit_before>package main

import (
	"crypto/md5"
	"crypto/sha1"
	"encoding/hex"
	"encoding/json"
	"flag"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	var (
		input  string
		datset string
	)

	flag.StringVar(&input, "f", "", "input file")
	flag.StringVar(&datset, "d", "", "datset")
	flag.Parse()

	if input == "" || datset == "" {
		flag.Usage()
		os.Exit(1)
	}

	var err error

	in, err := os.Open(input)
	if err != nil {
		panic(err)
	}
	defer in.Close()

	h1, h2 := md5.New(), sha1.New()

	io.Copy(io.MultiWriter(h1, h2), in)

	md5hash := strings.ToUpper(hex.EncodeToString(h1.Sum(nil)))
	sha1hash := strings.ToUpper(hex.EncodeToString(h2.Sum(nil)))

	f, err := os.Open(datset)
	if err != nil {
		panic(err)
	}
	defer f.Close()

	p := NewParser(f)

	col, err := p.Parse()
	if err != nil {
		panic(err)
	}

	for _, g := range col.Games {
		if g.ROM.MD5 != md5hash && g.ROM.SHA1 != sha1hash {
			continue
		}

		b, err := json.MarshalIndent(g, "", "  ")
		if err != nil {
			panic(err)
		}

		fmt.Printf("Found matching ROM:\n%s\n", b)
	}
}
<commit_msg>Clean up output<commit_after>package main

import (
	"crypto/md5"
	"crypto/sha1"
	"encoding/hex"
	"encoding/json"
	"flag"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	var (
		input  string
		datset string
	)

	flag.StringVar(&input, "f", "", "input file")
	flag.StringVar(&datset, "d", "", "datset")
	flag.Parse()

	if input == "" || datset == "" {
		flag.Usage()
		os.Exit(1)
	}

	var err error

	in, err := os.Open(input)
	if err != nil {
		panic(err)
	}
	defer in.Close()

	h1, h2 := md5.New(), sha1.New()

	io.Copy(io.MultiWriter(h1, h2), in)

	md5hash := strings.ToUpper(hex.EncodeToString(h1.Sum(nil)))
	sha1hash := strings.ToUpper(hex.EncodeToString(h2.Sum(nil)))

	f, err := os.Open(datset)
	if err != nil {
		panic(err)
	}
	defer f.Close()

	p := NewParser(f)

	col, err := p.Parse()
	if err != nil {
		panic(err)
	}

	for _, g := range col.Games {
		if g.ROM.MD5 != md5hash && g.ROM.SHA1 != sha1hash {
			continue
		}

		b, err := json.MarshalIndent(g, "", "  ")
		if err != nil {
			panic(err)
		}

		fmt.Println(string(b))
	}
}

{'fraction_non_alphanumeric': 0.1991444866920152, 'fraction_numerical': 0.016159695817490494, 'mean_word_length': 3.095330739299611, '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': '427381', 'n_tokens_mistral': 975, 'n_tokens_neox': 914, 'n_words': 187}