Open-source speech recognition toolkit for training, inference, streaming ASR, VAD, punctuation, speaker diarization pipelines, and OpenAI-compatible/MCP serving.
Python asraudiochineseemotion-recognitionfunasrmcp-servermultilingual-asropenai-compatible-apiparaformerpunctuationpytorchreal-time-asrspeaker-diarizationspeech-recognitionspeech-to-textstreaming-asrtranscriptionvllmvoice-activity-detectionwhisper-alternative
fix(sensevoice): keep words separate at standalone boundaries
LauraGPTa57cc3f92a50
diff --git a/funasr/models/sense_voice/model.py b/funasr/models/sense_voice/model.pyindex c2f89eefd..d822939d5 100644--- a/funasr/models/sense_voice/model.py+++ b/funasr/models/sense_voice/model.py@@ -1093,6 +1093,7 @@ class SenseVoiceSmall(nn.Module):start = int(start * 1000)end = int(end * 1000)if word == "▁":+ prev_word = Nonecontinueif i == 0:word = word[1:] if word.startswith("▁") else worddiff --git a/tests/test_sensevoice_word_timestamps.py b/tests/test_sensevoice_word_timestamps.pyindex 5f1a4e9be..c1e539d99 100644--- a/tests/test_sensevoice_word_timestamps.py+++ b/tests/test_sensevoice_word_timestamps.py@@ -66,6 +66,24 @@ from funasr.models.sense_voice.model import SenseVoiceSmallpytest.param(["A", "\u2581B", "C"], ["A", "BC"], [[0, 125], [125, 375]], id="word-boundary"),+ pytest.param(+ ["Hello", "\u2581", "world"],+ ["Hello", "world"],+ [[0, 125], [250, 375]],+ id="standalone-word-boundary",+ ),+ pytest.param(+ ["\u2581Hel", "lo", "\u2581", "wor", "ld"],+ ["Hello", "world"],+ [[0, 250], [375, 625]],+ id="subpieces-around-standalone-boundary",+ ),+ pytest.param(+ ["Hello", "\u2581", "\u2581", "world"],+ ["Hello", "world"],+ [[0, 125], [375, 500]],+ id="repeated-standalone-boundaries",+ ),],)def test_post_preserves_word_boundaries_and_timestamp_alignment(tokens, words, timestamps):