Repository navigation
减少语音句尾丢字,修复空格滑动光标分隔符与九键拼音栏锁争用 - #151
Draft
Slacker-LLC wants to merge 1 commit into
Draft
Slacker-LLC wants to merge 1 commit into
Slacker-LLC wants to merge 1 commit into
Conversation
- 语音:松手后麦克风再录 200ms,由采集线程自己 stop() 并用 READ_NON_BLOCKING 读空录音器剩余音频;外部 stop 只作看门狗。此前松手即停且循环按 running 退出, 录音器内部缓冲里最后一块被丢弃。 - 语音:Paraformer 收尾静音 0.3s → 0.66s,与 sherpa-onnx 官方 Python 示例一致。 - 空格滑动:预编辑里的 ' 和空格不占一格;语音等待结果期间不处理滑动, 否则 prepareForManualInput 会取消并丢掉整句转写。 - 九键:解码器的只读查询去掉 @synchronized,拼音栏主线程查询不再排在 候选线程的 resolve() 后面;readingOptions 加 16 项 LRU,重复刷新取缓存。 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012wKchue4wWKw2WmV6Kcw8S
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
静态审查(语音、空格滑动光标、九键拼音索引)后修的几处问题。未在真机验证,见下方“未验证”。
语音丢字
record.stop(),采集循环按running退出,AudioRecord 内部缓冲里没读出的最后一块被丢弃(Windows 的waveInReset会把已录缓冲全部交还,没有这个问题)。现在松手后再录 200ms,由采集线程自己stop(),再用READ_NON_BLOCKING读空剩余;外部 stop 只作看门狗(再等 400ms)。online-decode-files.py一致(Windows 仓库同步,另一个 PR)。prepareForManualInput(它会取消整段识别)。空格滑动光标
'和空格不再占一格(ni|'hao与ni'|hao是同一位置),逻辑在PreeditCursorPolicy。九键拼音栏
NineKeyLocalDecoder的只读查询(trie 与各表在 init 后不再写入)去掉@Synchronized,拼音栏在主线程的查询不再排在候选线程resolve()后面;readingOptions加 16 项 LRU。Affected areas
Verification
:app:testDebugUnitTest:612 项,611 通过。唯一失败VoiceModelTrustPolicyTest.bundledCatalogTrustsOnlyExactOfficialManifestAndLayout因为本环境只拉了app/libs的 LFS,模型文件还是指针,与本改动无关。:app:lintDebug:app:assembleDebuggit diff --check新增测试:
PreeditCursorPolicyTest、NineKeyDecoderThreadingTest(持有解码器锁时只读查询仍能返回)、LocalAudioVoiceBackendTest的残余排空用例。未验证(需真机)
stop()之后read()能否取出残留音频因机型而异。对照现有日志captureFinished … capturedSamples与captureResidual samples=。resolveNineKey的耗时(OpenImeNineKeyPerf日志)未测,本 PR 没动这部分。Change log and version
[Unreleased]inCHANGELOG.md.VERSION.Privacy and delivery
Generated by Claude Code