Skip to content

Commit

Permalink
Force English transcription when using multilingual model
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmab committed Sep 11, 2024
1 parent bd23d7a commit 4e7f7dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/recognizer/whisper.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ func (r *whisperRecognizer) Recognize(ctx context.Context, sample []float32) (st
prompt := fmt.Sprintf("You receive commands in this template: {Either ANYFACE or %s} {PILOT CALLSIGN} {DIGITS} {'RADIO' or 'ALPHA' or 'BOGEY' or 'PICTURE' or 'DECLARE' or 'SNAPLOCK' or 'SPIKED'} {ARGUMENTS}. Parse numbers as digits. Separate numbers if there is silence between them. You may hear keywords in the arguments such as BULLSEYE or BRAA.", r.callsign)
wCtx.SetInitialPrompt(prompt)

if wCtx.IsMultilingual() {
_ = wCtx.SetLanguage("en")
}

err = wCtx.Process(
sample,
func(segment whisper.Segment) {
Expand Down

0 comments on commit 4e7f7dc

Please sign in to comment.