<commit_before>package models

import (
	"log"
)

type SuggestItem struct {
	Term   string        `json:"term"`
	Weight int            `json:"weight"`
}

// Comparator function (sort by weights)
func SuggestItemComparator(a, b interface{}) int {

	// Type assertion, program will panic if this is not respected
	c1 := a.(SuggestItem)
	c2 := b.(SuggestItem)

	log.Print("Item 1:" + c1.Term)
	log.Print("Item 2:" + c2.Term)
	switch {
	case c1.Weight > c2.Weight:
		return 1
	case c1.Weight < c2.Weight:
		return -1
	default:
		return 0
	}
}<commit_msg>Fixed SuggestItem type assertion and reversed weight comparison.  Added string comparison.<commit_after>package models

import (
)

type SuggestItem struct {
	Term   string        `json:"term"`
	Weight int            `json:"weight"`
}

// Comparator function (sort by weights)
func SuggestItemComparator(a, b interface{}) int {

	// Type assertion, program will panic if this is not respected
	c1 := a.(*SuggestItem)
	c2 := b.(*SuggestItem)

	switch {
	case c1.Weight > c2.Weight:
		return -1
	case c1.Weight < c2.Weight:
		return 1
	default:
		switch {
		case c1.Term > c2.Term:
			return 1
		case c1.Term < c2.Term:
			return -1
		default:
			return 0
		}
	}
}
{'fraction_non_alphanumeric': 0.11551155115511551, 'fraction_numerical': 0.0231023102310231, 'mean_word_length': 3.0704697986577183, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '4700350', 'n_tokens_mistral': 450, 'n_tokens_neox': 414, 'n_words': 129}