Repository navigation
fix(postprocess): keep a space between Latin VAD segments in rich transcription - #3872
Merged
LauraGPT merged 1 commit intoNov 12, 2026
Conversation
…nscription AutoModel joins the tagged SenseVoice text of each VAD segment with a single space, so a long English recording reaches rich_transcription_postprocess() as several <|lang|> blocks. The function strips every block and concatenates them with no separator, so "Hello world." and "How are you?" become "Hello world.How are you?" and the last word of one segment runs into the first word of the next. Insert a space between two blocks when both boundary characters belong to a space-separated script (ASCII or Hangul). Chinese and Japanese text and emoji boundaries are still joined without a space. The same change is applied to the funasr_onnx and funasr_torch copies so the three shipped postprocessors stay identical, and the event-segment test that pinned the glued "helloworld" output now expects "hello world". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
LauraGPT
added a commit
that referenced
this pull request
Nov 12, 2026
Preserve the original PR #3872 author commit. Synchronize current main content so the exact-head text workflow includes test_type_utils_compat.py. No test removal, history rewrite, or protection bypass. Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
LauraGPT
added a commit
that referenced
this pull request
Nov 12, 2026
…ain CI Retain original #3872 authorship and integrate the tested current-main tree. Exact-head tests and complete protection accepted without bypass. Signed-off-by: LauraGPT <zhifu.gzf@alibaba-inc.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rich_transcription_postprocess()glues the last word of one VAD segment to the first word of the next for English (and Korean) SenseVoice output.AutoModel.inference_with_vadjoins the tagged text of each VAD segment with a single space, so a long recording reaches the postprocessor as several<|lang|>blocks:The function strips every block and concatenates them with no separator:
This is the README / SenseVoice example flow (
vad_model="fsmn-vad"followed byrich_transcription_postprocess(res[0]["text"])) on any English recording long enough to produce more than one segment (with or withoutmerge_vad).Fix: when appending a block, insert one space if both boundary characters belong to a space-separated script (ASCII or Hangul). Chinese/Japanese text and emoji boundaries are joined exactly as before. The same change is applied to the
funasr_onnxandfunasr_torchcopies so the three shipped postprocessors stay identical (the existing parity tests load all three).Type of change
Validation
Environment: macOS arm64, Python 3.11.15, CPU-only torch 2.15.0, pytest 9.2.0.
test_vad_segments_keep_a_space_between_spaced_scriptsintests/test_rich_transcription_postprocess.py(English, mid-sentence split, Korean, plus Chinese and Chinese-to-English controls, for all three copies).test_repeated_event_only_segments_keep_following_textintests/test_rich_transcription_event_segments.pypinned the glued"helloworld"output for two separate<|en|>blocks; it now expects"hello world".python -m pytest -q tests/test_rich_transcription_postprocess.py tests/test_rich_transcription_event_segments.py: with themainsource files, 18 failed / 33 passed (9 new spaced-script cases + the 9 updated event cases; the CJK controls pass); with this change, 51 passed.test_postprocess_hotwords.py,test_sentence_postprocess_timestamps.py,test_speaker_emotion_docs.py,test_paraformer_timestamp_*.py,test_sensevoice_word_timestamps.py,test_funasr_onnx_installed.py,test_funasr_torch_package.py): 143 passed, 1 skipped.AutoModel.inference_with_vadwith stub VAD/ASR models returning two English segments:mainprintsHello world.How are you?, this branchHello world. How are you?.python -m compileall funasr examples testsNo model weights were run; SenseVoice output was simulated with tagged strings.
User impact
SenseVoice users transcribing English or Korean audio longer than one VAD segment get readable text instead of words running into each other at every segment boundary.
Notes for reviewers
format_str_v2already glues emoji to adjacent text.🤖 Generated with Claude Code