transcription

package
v0.35.21 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

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

func ConfiguredLocalModel(cfg *config.Config) string

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

func ConfiguredModelHints(cfg *config.Config) map[string]string

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

type VocabularyEntry struct {
	Spoken    string
	Canonical string
}

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.

Jump to

Keyboard shortcuts

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