<commit_before>package main

import (
	"fmt"
	"io/ioutil"
	"math"
	"strconv"
)

func main() {
	for i := 5; i <= 25; i++ {
		generateImage(i, 0.5/float64(i), 3, 1.5, 1)
	}
}

func generateImage(numBars int, spacing, width, height, xScale float64) {
	viewBox := fmt.Sprintf("%f %f %f %f", -width/2, 0.0, width, height)
	svgData := "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" " +
		"\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">" +
		"<svg xmlns=\"http://www.w3.org/2000/svg\" " +
		"xmlns:xlink=\"http://www.w3.org/1999/xlink\" " +
		"viewBox=\"" + viewBox + "\"><g fill=\"black\">"
	rectTemplate := "<rect fill=\"inherit\" x=\"%f\" y=\"%f\" " +
		"width=\"%f\" height=\"%f\" />"
	barWidth := (width - spacing*float64(numBars+1)) / float64(numBars)
	for i := 0; i < numBars; i++ {
		xVal := -width/2.0 + float64(i+1)*spacing + barWidth*float64(i)
		useXVal := (xVal + barWidth/2) * xScale
		yVal := height*math.Exp(-useXVal * useXVal)
		svgData += fmt.Sprintf(rectTemplate, xVal, height-yVal, barWidth, yVal)
	}
	svgData += "</g></svg>"
	ioutil.WriteFile("histogram"+strconv.Itoa(numBars)+".svg", []byte(svgData), 0777)
}<commit_msg>generate SVG images<commit_after>package main

import (
	"fmt"
	"io/ioutil"
	"math"
	"strconv"
)

const (
	Width = 40
	Height = 15
	OutwardRadius = 2
)

type Config struct {
	Count    int
	BarWidth int
	Spacing  int
}

func (c Config) Width() int {
	return c.Count*c.BarWidth + (c.Count-1)*c.Spacing
}

func main() {
	for i := 5; i <= 11; i++ {
		spacing := math.Ceil(10.0 / float64(i))
		barWidth := math.Floor((Width - spacing*float64(i+1)) / float64(i))
		generateImage(Config{i, int(barWidth), int(spacing)})
	}
}

func generateImage(c Config) {
	xOffset := (Width - c.Width()) / 2
	viewBox := fmt.Sprintf("0 0 %d %d", 40, Height)
	svgData := "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.0//EN\" " +
		"\"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd\">" +
		"<svg xmlns=\"http://www.w3.org/2000/svg\" " +
		"xmlns:xlink=\"http://www.w3.org/1999/xlink\" " +
		"viewBox=\"" + viewBox + "\" ><g fill=\"#777\">"
	rectTemplate := "<rect fill=\"inherit\" x=\"%d\" y=\"%d\" " +
		"width=\"%d\" height=\"%d\" />"
	xSpacing := OutwardRadius*2.0 / float64(c.Count+1)
	for i := 0; i < c.Count; i++ {
		xVal := -OutwardRadius + float64(i+1)*xSpacing
		height := math.Floor(Height * math.Exp(-xVal * xVal / 2))
		barXVal := xOffset + (c.Spacing + c.BarWidth) * i
		svgData += fmt.Sprintf(rectTemplate, int(barXVal), int(Height - height), int(c.BarWidth),
			int(height))
	}
	svgData += "</g></svg>"
	ioutil.WriteFile("histogram"+strconv.Itoa(c.Count)+".svg", []byte(svgData), 0777)
}
{'fraction_non_alphanumeric': 0.23558421851289832, 'fraction_numerical': 0.04969650986342944, 'mean_word_length': 3.5387263339070567, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 4}, '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': '7348651', 'n_tokens_mistral': 1243, 'n_tokens_neox': 1116, 'n_words': 212}