<commit_before>package string2strings

import (
	"bytes"
	"encoding/json"
	"sort"
	"strings"
)

type SortedStrings []string

func NewSortedStrings() SortedStrings {
	var sorted SortedStrings
	return sorted
}

func NewSortedStringsFromStrings(values []string) SortedStrings {
	var sorted SortedStrings
	for _, value := range values {
		sorted = sorted.Insert(value)
	}
	return sorted
}

func (list SortedStrings) Insert(value string) SortedStrings {
	index := sort.SearchStrings(list, value)
	if index == len(list) || list[index] != value {
		// Grow list by one element. We'll use string's zero
		// value for now because it will be overwritten.
		list = append(list, "")

		// Shift elements down one slot.
		copy(list[index+1:], list[index:])

		// Insert value into proper position.
		list[index] = value
	}
	return list
}

func (list SortedStrings) Delete(value string) SortedStrings {
	index := sort.SearchStrings(list, value)
	if index < len(list) && list[index] == value {<commit_msg>use copy and standard library sort to sort the strings<commit_after>package string2strings

import (
	"bytes"
	"encoding/json"
	"sort"
	"strings"
)

type SortedStrings []string

func NewSortedStrings() SortedStrings {
	var sorted SortedStrings
	return sorted
}

func NewSortedStringsFromStrings(values []string) SortedStrings {
	result := make([]string, len(values))
	copy(result, values)
	sort.Strings(result)
	return SortedStrings(result)
}

func (list SortedStrings) Insert(value string) SortedStrings {
	index := sort.SearchStrings(list, value)
	if index == len(list) || list[index] != value {
		// Grow list by one element. We'll use string's zero
		// value for now because it will be overwritten.
		list = append(list, "")

		// Shift elements down one slot.
		copy(list[index+1:], list[index:])

		// Insert value into proper position.
		list[index] = value
	}
	return list
}

func (list SortedStrings) Delete(value string) SortedStrings {
	index := sort.SearchStrings(list, value)
	if index < len(list) && list[index] == value {
{'fraction_non_alphanumeric': 0.11538461538461539, 'fraction_numerical': 0.0019723865877712033, 'mean_word_length': 4.528610354223433, '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': '6298009', 'n_tokens_mistral': 660, 'n_tokens_neox': 634, 'n_words': 198}