Fall back to VAD-aligned string sentence records when a sized punctuation array cannot align with long-audio ASR timestamps.
Verified against both reporter attachments: 103.mp3 recovers 199 sentence records and 2980.mp3 remains byte-for-byte unchanged.
Signed-off-by: LauraGPT <[email protected]>
* Fix#2839: initialize punc_res before conditional to prevent UnboundLocalError
When punc_model is None or not provided, punc_res was only assigned inside
the `if self.punc_model is not None:` block. Downstream code paths
(punc_segment speaker diarization and sentence_timestamp) accessed punc_res
unconditionally, causing UnboundLocalError.
Changes:
- Initialize punc_res = None before the conditional block
- Add punc_res is None guard in punc_segment path with error log
- Add punc_res is None guard in sentence_timestamp path with warning log
- Add unit tests covering punc_model=None, empty punc_model, and normal flow
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Signed-off-by: Lidang-Jiang <[email protected]>
* fix: update docstring to only mention punc_model=None case
The tests only cover the None case, not the empty string case. Update
the module docstring to match actual test coverage.
Signed-off-by: Lidang-Jiang <[email protected]>
---------
Signed-off-by: Lidang-Jiang <[email protected]>