<commit_before>package u32

import "sort"

type Count struct {
	Num uint32
	Sum uint8
}

type SetCount map[uint32]*Count

func (m SetCount) Add(sets ...*Set) {
	for _, set := range sets {
		for k := range *set {
			if mv, ok := m[k]; ok {
				mv.Sum += 1
			} else {
				m[k] = &Count{Num: k, Sum: 1}
			}
		}
	}
}

func (m SetCount) Count(removeSets ...*Set) []Count {
	ret := make([]Count, len(m))
	i := 0
	set := NewSet()
	set.Union(removeSets...)
	for _, v := range m {
		if !set.Has(v.Num) {
			ret[i] = *v
			i++
		}
	}
	sort.Slice(ret, func(i, j int) bool {
		if ret[i].Sum == ret[j].Sum {
			return ret[i].Num < ret[j].Num
		}
		return ret[j].Sum < ret[i].Sum
	})
	return ret
}
<commit_msg>fix #23<commit_after>package u32

import "sort"

type Count struct {
	Num uint32
	Sum uint8
}

type SetCount map[uint32]*Count

func (m SetCount) Add(sets ...*Set) {
	for _, set := range sets {
		for k := range *set {
			if mv, ok := m[k]; ok {
				mv.Sum += 1
			} else {
				m[k] = &Count{Num: k, Sum: 1}
			}
		}
	}
}

func (m SetCount) Count(removeSets ...*Set) []Count {
	ret := make([]Count, 0)
	set := NewSet()
	set.Union(removeSets...)
	for _, v := range m {
		if !set.Has(v.Num) {
			ret = append(ret, *v)
		}
	}
	sort.Slice(ret, func(i, j int) bool {
		if ret[i].Sum == ret[j].Sum {
			return ret[i].Num < ret[j].Num
		}
		return ret[j].Sum < ret[i].Sum
	})
	return ret
}

{'fraction_non_alphanumeric': 0.19420289855072465, 'fraction_numerical': 0.015942028985507246, 'mean_word_length': 2.6057441253263707, 'pattern_counts': {'":': 0, '<': 7, '<?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': '3250439', 'n_tokens_mistral': 657, 'n_tokens_neox': 595, 'n_words': 157}