feat: add auto-language detection support to stt-ptt
- Add STT_LANGUAGE environment variable (default: auto) - Modify whisper-cli call to use -l flag with language code - Add language option to HM module (enum with 23 common languages + auto) - Update help text to document STT_LANGUAGE variable
This commit is contained in:
@@ -77,6 +77,56 @@ in {
|
||||
'';
|
||||
example = 5000;
|
||||
};
|
||||
|
||||
language = mkOption {
|
||||
type = types.enum [
|
||||
"auto"
|
||||
"en"
|
||||
"es"
|
||||
"fr"
|
||||
"de"
|
||||
"it"
|
||||
"pt"
|
||||
"ru"
|
||||
"zh"
|
||||
"ja"
|
||||
"ko"
|
||||
"ar"
|
||||
"hi"
|
||||
"tr"
|
||||
"pl"
|
||||
"nl"
|
||||
"sv"
|
||||
"da"
|
||||
"fi"
|
||||
"no"
|
||||
"vi"
|
||||
"th"
|
||||
"id"
|
||||
"uk"
|
||||
"cs"
|
||||
];
|
||||
default = "auto";
|
||||
description = ''
|
||||
Language for speech recognition. Use "auto" for automatic language detection,
|
||||
or specify a language code (ISO 639-1 standard) for better accuracy.
|
||||
|
||||
Auto-detection analyzes the audio to determine the spoken language automatically.
|
||||
Specifying a language can improve accuracy if you know the language in advance.
|
||||
|
||||
Common language codes:
|
||||
- en: English
|
||||
- es: Spanish
|
||||
- fr: French
|
||||
- de: German
|
||||
- zh: Chinese
|
||||
- ja: Japanese
|
||||
- ko: Korean
|
||||
|
||||
whisper.cpp supports 100+ languages. See whisper.cpp documentation for the full list.
|
||||
'';
|
||||
example = "en";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
@@ -84,6 +134,7 @@ in {
|
||||
|
||||
home.sessionVariables = {
|
||||
STT_MODEL = modelPath;
|
||||
STT_LANGUAGE = cfg.language;
|
||||
STT_NOTIFY_TIMEOUT = toString cfg.notifyTimeout;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user