<commit_before>package main

import (
	"bytes"
	mwclient "cgt.name/pkg/go-mwclient"
	"fmt"
	"sort"
	"strings"
)

type warning struct {
	title        string
	warning      string
	warningLower string // Lower case version for string-insensitive sort.
}

type warnings []warning

// Sort interface functions.
func (warnings warnings) Len() int {
	return len(warnings)
}

func (warnings warnings) Less(i, j int) bool {
	return warnings[i].warningLower < warnings[j].warningLower
}

func (warnings warnings) Swap(i, j int) {
	warnings[i], warnings[j] = warnings[j], warnings[i]
}

func (warnings *warnings) Append(files []fileData) {
	for i := range files {
		if files[i].warning != "" {
			*warnings = append(*warnings, warning{files[i].title, files[i].warning, strings.ToLower(strings.TrimSpace(files[i].warning))})
		}
	}
}

// Create a gallery showing all the files with warnings. Page must already<commit_msg>get rid of spaces in the other field too.<commit_after>package main

import (
	"bytes"
	mwclient "cgt.name/pkg/go-mwclient"
	"fmt"
	"sort"
	"strings"
)

type warning struct {
	title        string
	warning      string
	warningLower string // Lower case version for string-insensitive sort.
}

type warnings []warning

// Sort interface functions.
func (warnings warnings) Len() int {
	return len(warnings)
}

func (warnings warnings) Less(i, j int) bool {
	return warnings[i].warningLower < warnings[j].warningLower
}

func (warnings warnings) Swap(i, j int) {
	warnings[i], warnings[j] = warnings[j], warnings[i]
}

func (warnings *warnings) Append(files []fileData) {
	for i := range files {
		if files[i].warning != "" {
			trimmed := strings.TrimSpace(files[i].warning)
			*warnings = append(*warnings, warning{files[i].title, trimmed, strings.ToLower(trimmed)})
		}
	}
}

// Create a gallery showing all the files with warnings. Page must already
{'fraction_non_alphanumeric': 0.129101667563206, 'fraction_numerical': 0.0, 'mean_word_length': 4.2100840336134455, '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': '1309427', 'n_tokens_mistral': 626, 'n_tokens_neox': 609, 'n_words': 179}