feat(desktop): propose typo fixes inside the suggestion popup and make suggestions snappier
While suggestions are on, typos are no longer replaced silently. The popup shows the fix next to the candidate and applies it only when the candidate is accepted. The per-minute request cap rises from 6 to 20 so suggestions keep appearing after accepting one and continuing to type.
This commit is contained in:
parent
d63854db67
commit
f5ae4c8c04
38 changed files with 1239 additions and 660 deletions
|
|
@ -5,16 +5,20 @@ import { describe, expect, it } from 'vitest'
|
|||
import {
|
||||
buildVocabulary,
|
||||
detectHangulTypedLatin,
|
||||
detectJamoNoise,
|
||||
detectLatinTypedHangul,
|
||||
detectTypoRevert,
|
||||
detectTypos,
|
||||
fixByVocabulary,
|
||||
fixKnownMisspelling,
|
||||
hasSuspiciousTypo,
|
||||
mergeTypoCorrections,
|
||||
hangulToLatin,
|
||||
isPlausibleTypoFix,
|
||||
latinToHangul,
|
||||
parseModelTypoPairs,
|
||||
planTypoReplacement,
|
||||
validateModelCorrections,
|
||||
typoRegionStart,
|
||||
validateModelCorrections
|
||||
} from '../src/typo-correction'
|
||||
|
|
@ -221,3 +225,33 @@ describe('되돌리기 감지', () => {
|
|||
expect(detectTypoRevert('그건 됐다 그리고', { from: '됬다', to: '됐다', tailLength: 4 })).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('낱자 잡음 (2026-10-17 실측 입력)', () => {
|
||||
const fixed = (text: string): string | null => planTypoReplacement(text, detectJamoNoise(text))?.insertText ?? null
|
||||
|
||||
it('음절 사이·앞에 끼어든 낱자 하나를 지운다', () => {
|
||||
expect(fixed('그ㅓ런건 전혀')).toBe('그런건 전혀')
|
||||
expect(fixed('내 가쓴ㄷ거에 대한')).toBe('가쓴거에 대한')
|
||||
expect(fixed('파츠가 ㅇ다른 UI')).toBe('다른 UI')
|
||||
expect(fixed('안ㄴ뇽하세여.?')).toBe('안뇽하세여.?')
|
||||
})
|
||||
|
||||
it('문장 중간에 홀로 남은 낱자는 뒤 공백과 함께 지운다 — 끝의 낱자를 지워도 "아직 " 이 남는다', () => {
|
||||
expect(fixed('실망스럽고 ㅇ ㅇ이전 까지')).toBe('이전 까지')
|
||||
expect(fixed('아직 ㅇ')).toBe('')
|
||||
expect(planTypoReplacement('아직 ㅇ', detectJamoNoise('아직 ㅇ'))?.deleteCount).toBe(1)
|
||||
})
|
||||
|
||||
it('의도한 낱자(ㅋㅋ·ㅠㅠ·끝의 감정 낱자·첫머리 대답)는 두고, 수상하다고 보지도 않는다', () => {
|
||||
for (const text of ['ㅋㅋ 좋아', '좋아ㅋㅋ', '고마워ㅎ', '미안ㅠ', 'ㅇ 알겠어', 'ㅇㅋ 그럼']) {
|
||||
expect(detectJamoNoise(text)).toEqual([])
|
||||
expect(hasSuspiciousTypo(text)).toBe(false)
|
||||
}
|
||||
})
|
||||
|
||||
it('모델 교정이 같은 단어의 낱자 지우기보다 앞선다', () => {
|
||||
const text = '안ㄴ뇽하세여.?'
|
||||
const model = validateModelCorrections(text, [{ from: '안ㄴ뇽하세여', to: '안녕하세요' }])
|
||||
expect(planTypoReplacement(text, mergeTypoCorrections(model, detectJamoNoise(text)))?.insertText).toBe('안녕하세요.?')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue