<commit_before>package core

import (
	"regexp"
	"strings"

	"github.com/af83/edwig/model"
)

var defaultIdentifierGenerators = map[string]string{
	"message_identifier":             "%{uuid}",
	"response_message_identifier":    "%{uuid}",
	"data_frame_identifier":          "%{id}",
	"reference_identifier":           "%{type}:%{default}",
	"reference_stop_area_identifier": "%{default}",
}

type IdentifierGenerator struct {
	model.UUIDConsumer

	formatString string
}

type IdentifierAttributes struct {
	Default string
	Id      string
	Type    string
}

func NewIdentifierGenerator(formatString string) *IdentifierGenerator {
	return &IdentifierGenerator{formatString: formatString}
}

func NewIdentifierGeneratorWithUUID(formatString string, uuidGenerator model.UUIDConsumer) *IdentifierGenerator {
	return &IdentifierGenerator{formatString: formatString, UUIDConsumer: uuidGenerator}
}

func (generator *IdentifierGenerator) NewIdentifier(attributes IdentifierAttributes) string {
	replacer := strings.NewReplacer("%{id}", attributes.Id, "%{type}", attributes.Type, "%{default}", attributes.Default)
	return generator.handleuuids(replacer.Replace(generator.formatString))<commit_msg>add subscription_identifier generator<commit_after>package core

import (
	"regexp"
	"strings"

	"github.com/af83/edwig/model"
)

var defaultIdentifierGenerators = map[string]string{
	"message_identifier":             "%{uuid}",
	"response_message_identifier":    "%{uuid}",
	"data_frame_identifier":          "%{id}",
	"reference_identifier":           "%{type}:%{default}",
	"reference_stop_area_identifier": "%{default}",
	"subscription_identifier":        "%{id}",
}

type IdentifierGenerator struct {
	model.UUIDConsumer

	formatString string
}

type IdentifierAttributes struct {
	Default string
	Id      string
	Type    string
}

func NewIdentifierGenerator(formatString string) *IdentifierGenerator {
	return &IdentifierGenerator{formatString: formatString}
}

func NewIdentifierGeneratorWithUUID(formatString string, uuidGenerator model.UUIDConsumer) *IdentifierGenerator {
	return &IdentifierGenerator{formatString: formatString, UUIDConsumer: uuidGenerator}
}

func (generator *IdentifierGenerator) NewIdentifier(attributes IdentifierAttributes) string {
	replacer := strings.NewReplacer("%{id}", attributes.Id, "%{type}", attributes.Type, "%{default}", attributes.Default)
	return generator.handleuuids(replacer.Replace(generator.formatString))
{'fraction_non_alphanumeric': 0.11579378068739771, 'fraction_numerical': 0.0016366612111292963, 'mean_word_length': 6.298507462686567, 'pattern_counts': {'":': 11, '<': 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': '3281262', 'n_tokens_mistral': 673, 'n_tokens_neox': 686, 'n_words': 137}