]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commit
whisper : make voice_length() utf-8 aware for CJK (#3915)
authorLin Xiaodong <redacted>
Wed, 1 Jul 2026 06:21:35 +0000 (14:21 +0800)
committerGitHub <redacted>
Wed, 1 Jul 2026 06:21:35 +0000 (08:21 +0200)
commit909307c8bd2edc8ff9ed631e2e11789d93123813
treeff671696b2c4e51e4f973989573c4eadbd4e3a89
parent0874de3e8e8e48361dba85c7fe6d176f008bf158
whisper : make voice_length() utf-8 aware for CJK (#3915)

* whisper : make voice_length() utf-8 aware for CJK

voice_length() weights each token by how long its text takes to say, which drives
how a segment's time is shared between its tokens. It looped over raw bytes, so
every CJK character (3 bytes) was counted ~3x and full-width punctuation never
matched, skewing token timestamps for Chinese/Japanese.

Decode one utf-8 code point at a time and give full-width ,。!? etc. the same
weights as their ASCII counterparts. Pure-ASCII text is unaffected.

* whisper : one statement per line in voice_length()

---------

Co-authored-by: linxiaodong <redacted>
src/whisper.cpp