customize

package
v0.46.1 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: Apache-2.0 Imports: 10 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 ReplacementsFromDictionary

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

func WordsFromDictionary

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

Types

type ApplyResult

type ApplyResult struct {
	Text    string
	Matches []MatchRecord
}

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 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
	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