exPHAT / SwiftWhisper

🎤 The easiest way to transcribe audio in Swift
MIT License
580 stars 61 forks source link

Split segment to words #30

Closed chichiller closed 11 months ago

chichiller commented 11 months ago

At first thank you for your job i have a question: when i transcribe audio file as PCM [Float] i receive as result [Segment] i noticed that each Segment may contain not separate word, but sentence how i can split sentence into separate words with timestamp for each? I tried to use WhisperParams fields:

  1. max_len = 1
  2. split_on_word = true

but result always the same The only thing is help me decrease words in sentence is using beamSearch strategy, but i still get sentence instead of separate words

my code

let params = WhisperParams(strategy: .beamSearch)
params.max_len = 1
params.split_on_word = true
whisper = Whisper(fromFileURL: modelUrl, withParams: params)
exPHAT commented 11 months ago

You can see the correct usage in https://github.com/exPHAT/SwiftWhisper/issues/6