Documentation
¶
Overview ¶
Package transcription provides STT model-selection helpers and the vocabulary-dictionary primitives that the desktop adapters consume.
This package is intentionally a leaf: it only depends on internal/config and internal/store, plus stdlib. It contains no references to the cmd/speechkit appState type and no Wails-specific code, so it is safe to import from any subpackage of cmd/speechkit without import cycles.
Index ¶
- func ApplyVocabularyCorrectionsWithMatches(text string, entries []VocabularyEntry) (string, []string)
- func BuildVocabularyPrompt(entries []VocabularyEntry) string
- func BuildVoiceAgentVocabularyHint(entries []VocabularyEntry) string
- func ConfiguredLocalModel(cfg *config.Config) string
- func ConfiguredModelHints(cfg *config.Config) map[string]string
- func SyncVocabularyDictionaryStore(ctx context.Context, feedbackStore store.Store, language, raw string) error
- func UserDictionaryStoreFromFeedbackStore(feedbackStore store.Store) store.UserDictionaryStore
- type VocabularyEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyVocabularyCorrectionsWithMatches ¶
func ApplyVocabularyCorrectionsWithMatches(text string, entries []VocabularyEntry) (string, []string)
ApplyVocabularyCorrectionsWithMatches replaces spoken forms with canonical forms inside text (case-insensitive, word-boundary aware) and returns both the corrected text and the list of canonical terms that actually matched at least once.
func BuildVocabularyPrompt ¶
func BuildVocabularyPrompt(entries []VocabularyEntry) string
BuildVocabularyPrompt produces the STT-prompt hint string given a dictionary, for providers that accept a free-form bias prompt.
func BuildVoiceAgentVocabularyHint ¶
func BuildVoiceAgentVocabularyHint(entries []VocabularyEntry) string
BuildVoiceAgentVocabularyHint produces the Voice-Agent system-prompt hint, which differs slightly from the STT prompt to bias both recognition and generation.
func ConfiguredLocalModel ¶
ConfiguredLocalModel returns the basename of the local whisper.cpp model the user has selected, or the model alias if no path is set.
func ConfiguredModelHints ¶
ConfiguredModelHints returns a per-provider map of currently configured transcription models, used for surfacing the active model in the UI and for telemetry hints.
func SyncVocabularyDictionaryStore ¶
func SyncVocabularyDictionaryStore(ctx context.Context, feedbackStore store.Store, language, raw string) error
SyncVocabularyDictionaryStore replaces the persisted user-dictionary entries for the given language with the entries parsed from the settings textarea. Returns nil if the feedback store does not implement UserDictionaryStore (legacy installs).
func UserDictionaryStoreFromFeedbackStore ¶
func UserDictionaryStoreFromFeedbackStore(feedbackStore store.Store) store.UserDictionaryStore
UserDictionaryStoreFromFeedbackStore narrows a store.Store to its UserDictionaryStore facet if available, nil otherwise.
Types ¶
type VocabularyEntry ¶
VocabularyEntry pairs a spoken form with its canonical written form. The dictionary helpers consume slices of these.
func ParseVocabularyDictionary ¶
func ParseVocabularyDictionary(raw string) []VocabularyEntry
ParseVocabularyDictionary parses the user-facing newline-separated dictionary text. Each line is either a bare term ("Kombify") or a "spoken => canonical" rewrite rule. Empty lines and rules with empty sides are silently dropped.
func VocabularyEntriesFromStore ¶
func VocabularyEntriesFromStore(ctx context.Context, dictionaryStore store.UserDictionaryStore, language string) ([]VocabularyEntry, error)
VocabularyEntriesFromStore loads enabled dictionary entries for the given language from the user-dictionary store. Nil store yields nil.