customize

package
v0.48.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 28, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildKeyterms

func BuildKeyterms(words []speechcustomize.Word) []string

func BuildPrompt

func BuildPrompt(words []speechcustomize.Word) string

func BuildVoiceAgentHint

func BuildVoiceAgentHint(words []speechcustomize.Word) string

func CanonicalTerms

func CanonicalTerms(words []speechcustomize.Word) []string

func PublicActions added in v0.47.0

func PublicActions(actions []Action) []speechkit.CustomizationAction

func ReplacementsFromDictionary

func ReplacementsFromDictionary(entries []DictionaryEntry) []speechcustomize.Replacement

func WordsFromDictionary

func WordsFromDictionary(entries []DictionaryEntry) []speechcustomize.Word

Types

type Action added in v0.47.0

type Action struct {
	ReplacementID string               `json:"replacement_id,omitempty"`
	Kind          speechcustomize.Kind `json:"kind"`
	Intent        string               `json:"intent,omitempty"`
	Text          string               `json:"text,omitempty"`
	Template      string               `json:"template,omitempty"`
	Payload       map[string]any       `json:"payload,omitempty"`
	MatchedText   string               `json:"matched_text,omitempty"`
	Count         int                  `json:"count"`
}

type ApplyResult

type ApplyResult struct {
	Text    string
	Matches []MatchRecord
	Actions []Action
}

func Apply

func Apply(text string, replacements []speechcustomize.Replacement, stage speechcustomize.Stage) (ApplyResult, error)

type CompiledApplier

type CompiledApplier struct {
	Replacements []speechcustomize.Replacement
	// contains filtered or unexported fields
}

func CompileApplier

func CompileApplier(replacements []speechcustomize.Replacement, context speechcustomize.Context) (*CompiledApplier, error)

func (*CompiledApplier) Apply

func (a *CompiledApplier) Apply(text string) ApplyResult

type DictionaryEntry

type DictionaryEntry struct {
	Spoken     string
	Canonical  string
	Language   string
	Source     string
	Enabled    bool
	UsageCount int
}

func DictionaryFromSet

func DictionaryFromSet(set Set) []DictionaryEntry

type MatchRecord

type MatchRecord struct {
	ReplacementID string `json:"replacement_id,omitempty"`
	Term          string `json:"term"`
	Count         int    `json:"count"`
}

type ProviderBias added in v0.47.0

type ProviderBias struct {
	Prompt     string
	Keyterms   []string
	ByProvider map[string]provideropts.Values
	Preview    []ProviderBiasPreview
}

func BuildProviderBias added in v0.47.0

func BuildProviderBias(words []speechcustomize.Word) ProviderBias

func BuildProviderBiasForModality added in v0.47.0

func BuildProviderBiasForModality(words []speechcustomize.Word, modality string) ProviderBias

type ProviderBiasPreview added in v0.47.0

type ProviderBiasPreview struct {
	Provider string
	Modality string
	Strategy string
	Native   bool
	Keyterms []string
	Prompt   string
}

type ReplacementStore

type ReplacementStore interface {
	ListReplacements(ctx context.Context, opts speechcustomize.ListOptions) ([]speechcustomize.Replacement, error)
}

type ResolvedSet

type ResolvedSet struct {
	Context        speechcustomize.Context
	Words          []speechcustomize.Word
	Replacements   []speechcustomize.Replacement
	Prompt         string
	Keyterms       []string
	VoiceAgentHint string
	ProviderBias   ProviderBias
	Applier        *CompiledApplier
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(opts ServiceOptions) *Service

func (*Service) Apply

func (s *Service) Apply(ctx context.Context, request speechcustomize.Context, text string) (ApplyResult, error)

func (*Service) Invalidate

func (s *Service) Invalidate()

func (*Service) Resolve

func (s *Service) Resolve(ctx context.Context, request speechcustomize.Context) (ResolvedSet, error)

type ServiceOptions

type ServiceOptions struct {
	Store                   any
	ScopeOrder              []speechcustomize.ScopeRef
	ActiveTemplateIDs       []string
	DisableBuiltinTemplates bool
}

type Set

type Set struct {
	Words        []speechcustomize.Word
	Replacements []speechcustomize.Replacement
}

type WordStore

type WordStore interface {
	ListWords(ctx context.Context, opts speechcustomize.ListOptions) ([]speechcustomize.Word, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL