<commit_before>package rootio

import (
	"fmt"
	"strconv"
	"strings"
)

// decodeNameCycle decodes a namecycle "aap;2" into name "aap" and cycle "2"
func decodeNameCycle(namecycle string) (string, int16) {
	var name string
	var cycle int16

	toks := strings.Split(namecycle, ";")
	switch len(toks) {
	case 0:
		name = namecycle
		cycle = 9999
	case 1:
		name = toks[0]
		cycle = 9999
	case 2:
		name = toks[0]
		i, err := strconv.Atoi(toks[1])
		if err != nil {
			// not a number
			cycle = 9999
		} else {
			cycle = int16(i)
		}
	default:
		panic(fmt.Errorf("invalid namecycle format [%v]", namecycle))
	}

	return name, cycle
}

// EOF<commit_msg>utils: only accept 0-or-1 ';' in namecycle<commit_after>package rootio

import (
	"fmt"
	"strconv"
	"strings"
)

// decodeNameCycle decodes a namecycle "aap;2" into name "aap" and cycle "2"
func decodeNameCycle(namecycle string) (string, int16) {
	var name string
	var cycle int16

	toks := strings.Split(namecycle, ";")
	switch len(toks) {
	case 1:
		name = toks[0]
		cycle = 9999
	case 2:
		name = toks[0]
		i, err := strconv.Atoi(toks[1])
		if err != nil {
			// not a number
			cycle = 9999
		} else {
			cycle = int16(i)
		}
	default:
		panic(fmt.Errorf("invalid namecycle format [%v]", namecycle))
	}

	return name, cycle
}

// EOF
{'fraction_non_alphanumeric': 0.1374223602484472, 'fraction_numerical': 0.03804347826086957, 'mean_word_length': 3.325503355704698, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6656167', 'n_tokens_mistral': 575, 'n_tokens_neox': 513, 'n_words': 142}