<commit_before>package stringext

import (
	"bytes"
	"fmt"
	"regexp"
	"strings"
	"unicode"
	"unicode/utf8"
)

var (
	specialCases = regexp.MustCompile(`(?m)[-.$/:_{}\s]`)
	acronyms     = regexp.MustCompile(`(Url|Http|Id|Io|Uuid|Api|Uri|Ssl|Cname|Oauth|Otp)$`)
	acronymsi    = regexp.MustCompile(`(URL|HTTP|ID|IO|UUID|API|URI|SSL|CNAME|OAUTH|OTP)`)
)

// ToLowerFirst lowers the first character of any given unicode char
func ToLowerFirst(ident string) string {
	r, n := utf8.DecodeRuneInString(ident)
	return string(unicode.ToLower(r)) + ident[n:]
}

// ToUpperFirst converts the first character of any given unicode char to
// uppercase
func ToUpperFirst(ident string) string {
	r, n := utf8.DecodeRuneInString(ident)
	return string(unicode.ToUpper(r)) + ident[n:]
}

// Pointerize returns the first character of a given string as lowercased, this
// method is intened to use as a function receiver generator
func Pointerize(ident string) string {
	r, _ := utf8.DecodeRuneInString(ident)
	return string(unicode.ToLower(r))
}

// JSONTag generates json tag for given string, it is using the javascript
// concepts
//
// eg: ID ->
// 	becomes "id" if it is at the beginning
//  	or
//  becomes "Id" if it is in the middle of the string
func JSONTag(n string, required bool) string {
	modified := ToLowerFirst(
		Normalize(
			DepunctWithInitialLower(n),
		),
	)

	tags := []string{modified}
	if !required {
		tags = append(tags, "omitempty")
	}

	return fmt.Sprintf("`json:\"%s\"`", strings.Join(tags, ","))
}
<commit_msg>Stringext: remove unnecessary func call<commit_after>package stringext

import (
	"bytes"
	"fmt"
	"regexp"
	"strings"
	"unicode"
	"unicode/utf8"
)

var (
	specialCases = regexp.MustCompile(`(?m)[-.$/:_{}\s]`)
	acronyms     = regexp.MustCompile(`(Url|Http|Id|Io|Uuid|Api|Uri|Ssl|Cname|Oauth|Otp)$`)
	acronymsi    = regexp.MustCompile(`(URL|HTTP|ID|IO|UUID|API|URI|SSL|CNAME|OAUTH|OTP)`)
)

// ToLowerFirst lowers the first character of any given unicode char
func ToLowerFirst(ident string) string {
	r, n := utf8.DecodeRuneInString(ident)
	return string(unicode.ToLower(r)) + ident[n:]
}

// ToUpperFirst converts the first character of any given unicode char to
// uppercase
func ToUpperFirst(ident string) string {
	r, n := utf8.DecodeRuneInString(ident)
	return string(unicode.ToUpper(r)) + ident[n:]
}

// Pointerize returns the first character of a given string as lowercased, this
// method is intened to use as a function receiver generator
func Pointerize(ident string) string {
	r, _ := utf8.DecodeRuneInString(ident)
	return string(unicode.ToLower(r))
}

// JSONTag generates json tag for given string, it is using the javascript
// concepts
//
// eg: ID ->
// 	becomes "id" if it is at the beginning
//  	or
//  becomes "Id" if it is in the middle of the string
func JSONTag(n string, required bool) string {
	modified := ToLowerFirst(Normalize(n))

	tags := []string{modified}
	if !required {
		tags = append(tags, "omitempty")
	}

	return fmt.Sprintf("`json:\"%s\"`", strings.Join(tags, ","))
}

{'fraction_non_alphanumeric': 0.13965004952129415, 'fraction_numerical': 0.002641135688345989, 'mean_word_length': 4.539305301645339, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '7450263', 'n_tokens_mistral': 1093, 'n_tokens_neox': 1054, 'n_words': 288}