Skip to content

Report the detected language in the Swift engine - #56

Merged
watzon merged 1 commit into
feature/detected-languagefrom
feature/engine-language-swift
Oct 27, 2026
Merged

watzon merged 1 commit into
feature/detected-languagefrom
feature/engine-language-swift

Conversation

@watzon

@watzon watzon commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

The Swift engine now lists detected_language in hello and puts language in final when the request has language: auto.

  • Whisper: the language of WhisperKit. When there are several results, the language of the most audio (by segment time) wins.
  • SenseVoice: the language comes from the first tag of the model (<|en|>), as zh, en, yue, ja, or ko. For long audio, the language of the most audio wins over the pieces.
  • No language with a named language, for other models, or with empty text.
  • detects_language already passes through: the engine sends the catalog entries as they are.
  • New unit tests: DetectedLanguageTests.

Tested on this Mac: swift build -c release, swift test (66 tests), cargo test -p sayso-core engine_catalog, and the conformance ready level with whisper-base (German WAV), whisper-tiny (English WAV), and sensevoice-small (English WAV): 31 checks each, 0 failed.

Raw transcribe with language: auto:

whisper-base, en.wav:  {"language":"en","text":"Hello! How are you doing today? ...","type":"final"}
whisper-base, de.wav:  {"language":"de","text":"Guten Tag, wie geht es Ihnen heute, ...","type":"final"}
whisper-base, de.wav, language "de": no language field
sensevoice-small, en.wav: {"language":"en", ...}
sensevoice-small, zh.wav: {"language":"zh", ...}
sensevoice-small, ja.wav: {"language":"ja", ...}
sensevoice-small, en.wav, language "en": no language field

Whisper gives the language that WhisperKit found, and SenseVoice gives it from
its first tag (<|en|>). The language of the most audio wins when a recording
has several results or pieces. The feature detected_language is in hello.
@watzon
watzon merged commit 2134561 into feature/detected-language Oct 27, 2026
26 checks passed
@watzon
watzon deleted the feature/engine-language-swift branch October 27, 2026 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant