feat(input,voice): instant first-word-after-focus PC layout fix and speech disfluency post-processing (INPUT-04, INPUT-19, AI-03, AI-05)
This commit is contained in:
parent
dbed97c348
commit
7a86afa7b0
22 changed files with 359 additions and 39 deletions
13
CHANGELOG.md
13
CHANGELOG.md
|
|
@ -12,6 +12,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Additional Whisper model management UI
|
||||
- Plugin system for custom pipelines
|
||||
|
||||
## [1.14.0] - 2026-10-29
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
> canonical Forgejo feed; no binaries are committed to this repository.
|
||||
|
||||
### Added
|
||||
- **First-word-after-focus (`pc` / `ㅔㅊ` / `ㅖㅊ` / `내ㅔㅊ`) instant Han/Eng conversion (검색창·새 입력칸 포커스 직후 첫 단어 및 `PC` 계열 한영 자동 전환).**
|
||||
- Fixes the race where clicking into a search bar or switching windows and immediately typing `pc` (`ㅔㅊ` / `ㅖㅊ`) before the first UIA snapshot absorbed the typed word into `_textAtFocus` (`editedSinceFocus = false`), blocking auto-correction.
|
||||
- Expands 2-letter loose-jamo acronyms (`ㅔㅊ` / `ㅖㅊ` → `PC`, `ㅐㄴ` / `ㅒㄴ` → `OS`, `ㅔㄱ` / `ㅖㄱ` → `PR`, `ㅊㅑ` → `CI`, `ㅍㅡ` → `VM`, `ㅔㅡ` / `ㅖㅡ` → `PM`, `ㅔㅐ` / `ㅖㅐ` → `PO`, `ㅗㄱ` → `HR`, `ㅑㄱ` → `IR`, `ㅇㅡ` → `DM`, `ㅡㅇ` → `MD`, `ㅔㅇ` / `ㅖㅇ` → `PD`, `ㅍㅔ` / `ㅍㅖ` → `VP`, `ㅠㅡ` → `BM`, `ㅆㅍ` → `TV`, `ㅑㅖ` → `IP`) and Korean-prefix + loose-jamo English compounds (`내ㅔㅊ` → `내PC`, `회사ㅔㅊ에서` → `회사PC에서`, `한글로ㅔㅊ라고` → `한글로PC라고`, `윈도우ㅐㄴ` → `윈도우OS`, `새ㅁㅔㅑ를` → `새API를`).
|
||||
- **Speech disfluency, self-correction, redundancy & STT homophone post-processing (`@d3ro/core/dictation-cleaner` & `builtin-clean-speech`).**
|
||||
- Adds deterministic zero-latency dictation cleanup (`cleanDictatedText`) right after STT transcription to remove standalone spoken fillers (`어`, `음`, `그 쓸데없는` — while preserving quoted mentions like `어라든가`, `아라든가` and demonstratives), mid-sentence self-corrections (`검색 아니 검색이 아니라 타이핑을` → `타이핑을`), word stutters (`내가 내가` → `내가`), redundant expressions (`쓸데없는 의미없는` → `불필요한`, `정리해 가지고 해 주는 거` → `정리해 주는 기능`), colloquial suffixes (`예를 들자면은` → `예를 들어`, `보면은` → `보면`), and clear contextual STT homophones (`스시가 영어로 변경되지` → `PC가 영어로 변경되지`, `그 길을 쓸 이유가` → `그 기능을 쓸 이유가`).
|
||||
- Upgrades `refine` post-processing (`llm-prompts.ts`), meeting transcript auto-polish (`MeetingModeService.polishTranscript`), and adds the built-in command preset **`구어·추임새·중복 정리`** (`builtin-clean-speech`, voice trigger `정리해줘` / `clean this up`) so spoken transcripts are cleaned up while strictly preserving the speaker's original tone (반말 / 해요체 / 합쇼체).
|
||||
|
||||
## [1.13.0] - 2026-10-29
|
||||
|
||||
> Published from an annotated tag. Installer and update metadata are served by the
|
||||
|
|
|
|||
|
|
@ -34,6 +34,21 @@ type CreateInput = Omit<
|
|||
// ============================================================
|
||||
|
||||
const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' | 'updatedAt'>> = [
|
||||
{
|
||||
id: 'builtin-clean-speech',
|
||||
name: '구어·추임새·중복 정리',
|
||||
description: '어·음·아 추임새, 말 바꾸기, 불필요한 중복 표현을 제거하고 원래 말투(반말·존댓말) 유지',
|
||||
prompt: `다음 음성 받아쓰기 텍스트에서 구어 군더더기와 음성 인식 오류를 정리해 읽기 좋은 문장으로 다듬어주세요.
|
||||
1. 화자의 원래 말투(반말·해요체·합쇼체)는 절대 바꾸지 말고 그대로 유지하세요.
|
||||
2. 무의미한 추임새('어', '음', '아', '그', '뭐', '막', '저기' 등)는 제거하되, 추임새 자체를 예시로 언급한 표현('어라든가 아라든가' 등)은 유지하세요.
|
||||
3. 말하다가 고쳐 말한 부분('검색 아니 검색이 아니라 타이핑' → '타이핑')은 취소한 앞부분을 지우고 최종 의도만 남기세요.
|
||||
4. 의미 중복('쓸데없는 의미없는' → '불필요한')과 같은 구절 반복은 한 번만 남기고 간결하게 정리하세요.
|
||||
5. 문맥상 명백한 음성 인식 동음이의어 오인식('PC' 문맥의 '스시/피씨' → 'PC')과 구어 어미('~하면은' → '~하면', '예를 들자면은' → '예를 들어')를 바로잡으세요.
|
||||
정리된 텍스트만 출력하세요.`,
|
||||
icon: 'AutoFixHigh',
|
||||
isBuiltin: true,
|
||||
order: 0
|
||||
},
|
||||
{
|
||||
id: 'builtin-translate',
|
||||
name: '번역',
|
||||
|
|
@ -41,7 +56,7 @@ const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' |
|
|||
prompt: '다음 텍스트를 {{targetLanguage}}로 번역해주세요.\n자연스럽고 정확한 번역만 출력하세요.',
|
||||
icon: 'Translate',
|
||||
isBuiltin: true,
|
||||
order: 0
|
||||
order: 1
|
||||
},
|
||||
{
|
||||
id: 'builtin-summarize',
|
||||
|
|
@ -50,7 +65,7 @@ const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' |
|
|||
prompt: '다음 텍스트의 핵심 내용을 3줄 이내로 요약해주세요.\n요약문만 출력하세요.',
|
||||
icon: 'Summarize',
|
||||
isBuiltin: true,
|
||||
order: 1
|
||||
order: 2
|
||||
},
|
||||
{
|
||||
id: 'builtin-formal',
|
||||
|
|
@ -59,7 +74,7 @@ const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' |
|
|||
prompt: '다음 텍스트를 격식 있는 비즈니스 문체로 다시 작성해주세요.\n원래 의미를 유지하면서 전문적인 톤으로 변환하세요.\n다시 작성된 텍스트만 출력하세요.',
|
||||
icon: 'Business',
|
||||
isBuiltin: true,
|
||||
order: 2
|
||||
order: 3
|
||||
},
|
||||
{
|
||||
id: 'builtin-explain-code',
|
||||
|
|
@ -68,7 +83,7 @@ const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' |
|
|||
prompt: '다음 코드를 한국어로 설명해주세요.\n각 부분이 무엇을 하는지 간결하게 설명하세요.',
|
||||
icon: 'Code',
|
||||
isBuiltin: true,
|
||||
order: 3
|
||||
order: 4
|
||||
},
|
||||
{
|
||||
id: 'builtin-free-prompt',
|
||||
|
|
@ -77,7 +92,7 @@ const BUILTIN_INSTRUCTIONS: ReadonlyArray<Omit<CustomInstruction, 'createdAt' |
|
|||
prompt: '{{userPrompt}}',
|
||||
icon: 'Edit',
|
||||
isBuiltin: true,
|
||||
order: 4
|
||||
order: 5
|
||||
}
|
||||
]
|
||||
|
||||
|
|
@ -151,9 +166,11 @@ function loadInstructions(scopeId: string): CustomInstruction[] {
|
|||
}
|
||||
const now = Date.now()
|
||||
if (!stored || stored.length === 0) return builtinDefaults(now)
|
||||
// 가져온 목록에 프리셋이 빠져 있으면 채운다(프리셋은 지울 수 없다).
|
||||
// 가져온 목록에 새로 추가된 프리셋이 빠져 있으면 맨 앞에 채우고 순서를 정렬한다(프리셋은 지울 수 없다).
|
||||
const ids = new Set(stored.map((i) => i.id))
|
||||
return [...stored, ...builtinDefaults(now).filter((b) => !ids.has(b.id))]
|
||||
const missing = builtinDefaults(now).filter((b) => !ids.has(b.id))
|
||||
if (missing.length === 0) return stored
|
||||
return [...missing, ...stored].map((item, idx) => ({ ...item, order: idx }))
|
||||
}
|
||||
|
||||
function saveInstructions(): void {
|
||||
|
|
|
|||
|
|
@ -225,6 +225,9 @@ class InputTelemetryService extends EventEmitter {
|
|||
private _rebaseFocusText = false
|
||||
/** 포커스 깜빡임 뒤 돌아온 칸 — 키보드로 친 채 돌아왔으므로 이미 편집한 칸으로 본다 */
|
||||
private _typedIntoFocus = false
|
||||
/** 현재 포커스/클릭 이후 실제로 글자 키를 쳤는가 (첫 스냅샷 전 빠른 입력 보존) */
|
||||
private _typedInCurrentFocus = false
|
||||
private _lastTypedHwnd: number | null = null
|
||||
/** 직전 스냅샷이 편집 가능한 칸이었는가 / 어느 창이었는가 (포커스 깜빡임 판정) */
|
||||
private _prevSnapshotEditable = false
|
||||
private _lastFocusHwnd: number | null = null
|
||||
|
|
@ -553,7 +556,13 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
this._lastKeyAt = Date.now()
|
||||
this._lastKeyClass = keyClass
|
||||
if (TYPING_KEY_CLASSES.has(keyClass)) this._lastTypedAt = this._lastKeyAt
|
||||
if (TYPING_KEY_CLASSES.has(keyClass)) {
|
||||
this._lastTypedAt = this._lastKeyAt
|
||||
this._typedInCurrentFocus = true
|
||||
this._lastTypedHwnd = this._foreground.hwnd
|
||||
} else if (keyClass === 'shortcut') {
|
||||
this._typedInCurrentFocus = false
|
||||
}
|
||||
// 진단: 키 값이 아니라 종류·수정자만 남긴다 (typed 판정이 왜 틀리는지 로그로 보이게)
|
||||
this._lastKeyDiag = `${keyClass}${vk === null ? `?${event.keycode}` : ''}${this._modifiers.ctrl ? '+C' : ''}${this._modifiers.alt ? '+A' : ''}${this._modifiers.meta ? '+M' : ''}`
|
||||
|
||||
|
|
@ -605,6 +614,7 @@ class InputTelemetryService extends EventEmitter {
|
|||
this._lastClickPos = position
|
||||
// 클릭은 다른 칸으로 옮겨 갔을 수 있다 — 다음 스냅샷의 텍스트를 새 기준으로 삼는다.
|
||||
this._rebaseFocusText = true
|
||||
this._typedInCurrentFocus = false
|
||||
this._terminalTracker.onPointerOrFocusChange(this._foreground.hwnd)
|
||||
}
|
||||
|
||||
|
|
@ -656,7 +666,10 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
if (isKeyboard) this._lastActiveTickAt = now
|
||||
this._lastEventAt = now
|
||||
this._sampleForeground(now, isKeyboard && gap >= 250)
|
||||
this._sampleForeground(
|
||||
now,
|
||||
isKeyboard && (gap >= 250 || this._rebaseFocusText || this._lastKeyClass === 'shortcut')
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -684,6 +697,9 @@ class InputTelemetryService extends EventEmitter {
|
|||
|
||||
const info = getForegroundWindowInfo()
|
||||
if (info) {
|
||||
if (info.hwnd !== this._foreground.hwnd) {
|
||||
this._typedInCurrentFocus = false
|
||||
}
|
||||
this._foreground = {
|
||||
appName: info.appName || null,
|
||||
windowTitle: info.title || null,
|
||||
|
|
@ -883,19 +899,27 @@ class InputTelemetryService extends EventEmitter {
|
|||
// 방금 친 글이 "들어올 때부터 있던 글" 이 되어 제안이 영영 안 뜬다. 클릭 없이 키보드로 치다가
|
||||
// 읽을 수 없는 요소를 거쳐 같은 창의 입력칸으로 돌아온 것이면 이미 편집한 칸으로 본다.
|
||||
const now = Date.now()
|
||||
this._typedIntoFocus =
|
||||
!this._rebaseFocusText &&
|
||||
!clearedByEnter &&
|
||||
const typedAfterFocus =
|
||||
this._typedInCurrentFocus &&
|
||||
this._foreground.hwnd !== null &&
|
||||
this._foreground.hwnd === this._lastFocusHwnd &&
|
||||
!this._prevSnapshotEditable &&
|
||||
this._lastTypedAt > this._lastClickAt &&
|
||||
this._foreground.hwnd === this._lastTypedHwnd &&
|
||||
this._lastTypedAt >= this._lastClickAt &&
|
||||
now - this._lastTypedAt <= SUGGESTION_DEFAULTS.recentTypingWindowMs
|
||||
this._typedIntoFocus =
|
||||
!clearedByEnter &&
|
||||
(typedAfterFocus ||
|
||||
(!this._rebaseFocusText &&
|
||||
this._foreground.hwnd !== null &&
|
||||
this._foreground.hwnd === this._lastFocusHwnd &&
|
||||
!this._prevSnapshotEditable &&
|
||||
this._lastTypedAt > this._lastClickAt &&
|
||||
now - this._lastTypedAt <= SUGGESTION_DEFAULTS.recentTypingWindowMs))
|
||||
this._lastFocusKey = focusKey
|
||||
this._textAtFocus = textForFocus
|
||||
this._rebaseFocusText = false
|
||||
if (clearedByEnter) {
|
||||
this._lastTypedAt = 0
|
||||
this._typedInCurrentFocus = false
|
||||
context.typedRecently = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1300,7 +1300,7 @@ class MeetingModeService extends EventEmitter {
|
|||
const polished = await this._rewriteTranscriptInChunks(
|
||||
llm,
|
||||
transcript,
|
||||
'다음 음성 전사 텍스트를 다듬어주세요. 필러 단어(음, 어, 그, 아 등)를 제거하고, 문장 구조를 자연스럽게 교정하되, 원래 의미와 내용은 절대 변경하지 마세요. 타임스탬프 형식 [MM:SS]과 화자 표기([화자 N] 등)는 그대로 유지하세요.',
|
||||
'다음 음성 전사 텍스트를 다듬어주세요. 필러 단어(음, 어, 그, 아, 뭐 등), 말 바꾸기(A 아니 A가 아니라 B → B), 불필요한 어절·의미 중복을 제거하고 문장 구조를 자연스럽게 교정하되, 화자의 원래 말투(반말/존댓말)와 의미·내용은 절대 변경하지 마세요. 타임스탬프 형식 [MM:SS]과 화자 표기([화자 N] 등)는 그대로 유지하세요.',
|
||||
ErrorCode.MeetingPolishFailed,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import { getLocalLLMService } from './LocalLLMService'
|
|||
import { getLlmGateway } from './llm/LlmGateway'
|
||||
import { buildInstructionInvocation, resolveTargetLanguage } from './llm-prompts'
|
||||
import { D3ROError, ErrorCode } from '@d3ro/core/errors'
|
||||
import { cleanDictatedText } from '@d3ro/core/dictation-cleaner'
|
||||
import { TIMING } from '@d3ro/core/constants'
|
||||
import { RecognitionState, AudioState } from '@d3ro/core/types'
|
||||
import type { KeyBindingActionId, VoiceMode, VoiceState, LLMAction } from '@d3ro/core/types'
|
||||
|
|
@ -948,6 +949,9 @@ class VoiceModeService extends EventEmitter {
|
|||
}
|
||||
if (!this._isCurrent(run)) return
|
||||
|
||||
// 결정적 구어 군더더기·추임새·말바꾸기·중복·동음이의어 1차 정리 (LLM 유무와 무관하게 0ms 즉시 적용)
|
||||
effectiveText = cleanDictatedText(effectiveText)
|
||||
|
||||
const route = this._resolveLlmRoute(overrideInstructionId)
|
||||
if (route.kind === 'insert-raw') {
|
||||
if (route.reason === 'llm-unavailable') {
|
||||
|
|
|
|||
|
|
@ -26,9 +26,15 @@ const logger = getLogger('llm-prompts')
|
|||
* PremiumLLMService는 NO_THINK prefix 없이 바로 사용.
|
||||
*/
|
||||
const BASE_SYSTEM_PROMPTS: Record<string, string> = {
|
||||
refine: `다음 음성 전사 텍스트를 자연스럽고 격식 있는 문어체로 다듬어주세요.
|
||||
원래 의미를 유지하면서 문법 오류를 수정하고, 불필요한 반복이나 필러를 제거하세요.
|
||||
다듬어진 텍스트만 출력하세요. 설명이나 부가 문구를 붙이지 마세요.`,
|
||||
refine: `다음 음성 받아쓰기 텍스트에서 구어 군더더기와 음성 인식 오류를 정리해 읽기 좋은 문장으로 다듬어주세요.
|
||||
|
||||
규칙:
|
||||
1. 말투(반말·해요체·합쇼체)는 화자가 말한 그대로 유지하세요. 반말을 존댓말로 바꾸거나 존댓말을 반말로 바꾸지 마세요.
|
||||
2. 추임새와 무의미한 간투사('어', '음', '아', '그', '뭐', '막', '저기' 등)는 모두 제거하세요. 단, 문장 안에서 그런 표현 자체를 예시로 언급한 경우('어라든가 아라든가 같은 추임새')는 지우지 마세요.
|
||||
3. 말하다가 고쳐 말한 부분('검색 아니 검색이 아니라 타이핑' → '타이핑', '내일 아니 모레' → '모레')은 취소한 앞부분을 지우고 최종 의도만 남기세요.
|
||||
4. 같은 뜻이나 구절의 중복('쓸데없는 의미없는' → '불필요한', 'PC라고 타이핑했을 때 PC라고 타이핑하면' → 'PC라고 타이핑하면')은 한 번만 남기고 간결하게 정리하세요.
|
||||
5. 문맥상 명백한 음성 인식(STT) 동음이의어 오인식(예: 'PC' 문맥의 '스시/피씨' → 'PC')과 어색한 구어 어미('~하면은' → '~하면', '예를 들자면은' → '예를 들어')를 자연스럽게 바로잡으세요.
|
||||
6. 다듬어진 텍스트만 출력하세요. 설명이나 따옴표, 머리말을 절대 붙이지 마세요.`,
|
||||
|
||||
translate: `다음 텍스트를 {{targetLanguage}}로 번역해주세요.
|
||||
자연스럽고 정확한 번역만 출력하세요. 원문이나 설명을 붙이지 마세요.`,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,17 @@ export const DEFAULT_VOICE_COMMAND_KEYWORDS: ReadonlyArray<DefaultKeywordEntry>
|
|||
'explain this'
|
||||
]),
|
||||
priority: 3
|
||||
},
|
||||
{
|
||||
instructionId: 'builtin-clean-speech',
|
||||
keywords: prefixKeywords([
|
||||
'정리해 주세요',
|
||||
'정리해주세요',
|
||||
'정리해 줘',
|
||||
'정리해줘',
|
||||
'clean this up'
|
||||
]),
|
||||
priority: 4
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -36,12 +36,12 @@ beforeEach(async () => {
|
|||
|
||||
describe('CustomInstructionService', () => {
|
||||
describe('initialize + getAll', () => {
|
||||
it('첫 실행 시 5개 프리셋이 생성된다', () => {
|
||||
it('첫 실행 시 6개 프리셋이 생성된다', () => {
|
||||
const svc = getCustomInstructionService()
|
||||
svc.initialize()
|
||||
|
||||
const all = svc.getAll()
|
||||
expect(all.length).toBe(5)
|
||||
expect(all.length).toBe(6)
|
||||
expect(all.every((i) => i.isBuiltin)).toBe(true)
|
||||
})
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ describe('CustomInstructionService', () => {
|
|||
|
||||
expect(created.isBuiltin).toBe(false)
|
||||
expect(created.name).toBe('My Custom')
|
||||
expect(svc.getAll().length).toBe(6)
|
||||
expect(svc.getAll().length).toBe(7)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ describe('CustomInstructionService', () => {
|
|||
svc.initialize()
|
||||
|
||||
expect(svc.delete('builtin-translate')).toBe(false)
|
||||
expect(svc.getAll().length).toBe(5)
|
||||
expect(svc.getAll().length).toBe(6)
|
||||
})
|
||||
|
||||
it('사용자 정의 명령어는 삭제할 수 있다', () => {
|
||||
|
|
@ -142,7 +142,7 @@ describe('CustomInstructionService', () => {
|
|||
})
|
||||
|
||||
expect(svc.delete(created.id)).toBe(true)
|
||||
expect(svc.getAll().length).toBe(5)
|
||||
expect(svc.getAll().length).toBe(6)
|
||||
})
|
||||
|
||||
it('없는 ID 삭제 시 false를 반환한다', () => {
|
||||
|
|
@ -184,7 +184,7 @@ describe('CustomInstructionService', () => {
|
|||
const all = svc.getAll()
|
||||
const translate = all.find((i) => i.id === 'builtin-translate')
|
||||
expect(translate!.prompt).toContain('{{targetLanguage}}') // 원래 프롬프트
|
||||
expect(all.length).toBe(6) // 프리셋 5 + 사용자 1
|
||||
expect(all.length).toBe(7) // 프리셋 6 + 사용자 1
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -102,4 +102,22 @@ describe('포커스 깜빡임', () => {
|
|||
const context = await capture(snapshot({ appName: 'notepad.exe', text: '원래 있던 글' }))
|
||||
expect(context?.editedSinceFocus).toBe(false)
|
||||
})
|
||||
|
||||
it('검색창 등을 클릭한 직후 첫 스냅샷이 찍히기 전에 글자 키(ㅔㅊ 등)를 쳤다면 첫 스냅샷부터 editedSinceFocus 가 true 이다', async () => {
|
||||
const internal = service as unknown as Internal & {
|
||||
_handleMouseDown(event: { x: number; y: number; button: number }): void
|
||||
_handleKeyDown(event: {
|
||||
keycode: number
|
||||
ctrlKey?: boolean
|
||||
altKey?: boolean
|
||||
shiftKey?: boolean
|
||||
metaKey?: boolean
|
||||
}): void
|
||||
}
|
||||
internal._handleMouseDown({ x: 100, y: 100, button: 1 })
|
||||
internal._handleKeyDown({ keycode: 25 })
|
||||
const context = await capture(snapshot({ appName: 'SearchHost.exe', controlName: '검색 상자', text: 'ㅔㅊ' }))
|
||||
expect(context?.editedSinceFocus).toBe(true)
|
||||
expect(context?.typedRecently).toBe(true)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ import { USER_TEXT } from './fixtures'
|
|||
useRedHarness()
|
||||
|
||||
describe('유스케이스: 커스텀 명령어 CRUD / 프리셋 보호 / IPC', () => {
|
||||
it('첫 실행 시 빌트인 5개가 있다', () => {
|
||||
it('첫 실행 시 빌트인 6개가 있다', () => {
|
||||
const svc = getCustomInstructionService()
|
||||
svc.initialize()
|
||||
expect(svc.getAll()).toHaveLength(5)
|
||||
expect(svc.getAll()).toHaveLength(6)
|
||||
expect(svc.getAll().every((i) => i.isBuiltin)).toBe(true)
|
||||
})
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ describe('유스케이스: 커스텀 명령어 CRUD / 프리셋 보호 / IPC', (
|
|||
expect(svc.getById('nope')).toBeNull()
|
||||
})
|
||||
|
||||
it('사용자 명령어를 추가하면 목록이 6개가 된다', () => {
|
||||
it('사용자 명령어를 추가하면 목록이 7개가 된다', () => {
|
||||
const svc = getCustomInstructionService()
|
||||
svc.initialize()
|
||||
const created = svc.create({
|
||||
|
|
@ -37,7 +37,7 @@ describe('유스케이스: 커스텀 명령어 CRUD / 프리셋 보호 / IPC', (
|
|||
icon: 'Edit',
|
||||
})
|
||||
expect(created.isBuiltin).toBe(false)
|
||||
expect(svc.getAll()).toHaveLength(6)
|
||||
expect(svc.getAll()).toHaveLength(7)
|
||||
})
|
||||
|
||||
it('빈 이름 명령어 추가는 거부된다', () => {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
> Status: ACTIVE
|
||||
> Last full audit: 2026-09-13
|
||||
> Last update: 2026-10-29 — **v1.13.0 릴리스 + 그래프 관계성 기반 극한 개인화(`INPUT-06`, `INPUT-20`) + 한영 형태론·전방 구문 감지 및 단일-시스콜 초고속 인플레이스 수정(`INPUT-19`, `INPUT-22`) + 전 표면 디자인파카(`designpaca`) 순회 감사(`SHELL-11`, `SHELL-15`).** (1) **그래프 관계성 & 극한 개인화:** `@d3ro/core/personal-graph` 및 `PersonalGraphService`에 앱별 연속 단문 메시지 간 세션 `follows` 체이닝(`_lastIndexedByScope`), 엔터 전송 직후 비워진 채팅창 문맥 복원(`recentWrites`), 증분 `shares_terms` 엣지 연결, 조사 차이 무관 어간 연속 이어쓰기(`stemContinuationsFrom`), 2-홉 그래프 경로 랭킹(`rankTwoHopGraphTargets`), 개인 그래프·어투 일치 기반 LLM 후보 재정렬(`scoreCandidatePersonalization`), 어간 바이그램 폴백 및 빈도 가중 개인 n-gram(`PersonalNgramModel`)을 추가했다(제안 노출 빈도는 그대로 유지). (2) **영어 감지 강화 & 초고속 타이핑 중 무경합 교정:** `@d3ro/core/typo-correction`에 확장 영어 어간(`EXTENDED_ENGLISH_STEMS`, `kubernetes`/`microsoft` 등)과 생산적 접두·접미 파생 형태론(`matchesInflectedOrDerivedEnglish`), 전방 영어 구문 호응(`새 ㅠㄷ `→`to be `, `새 애 this `→`to do this `, `랙 솓 `→`for the ` vs `오늘 새 API를 만들었어` 보존), 영어 축약형·약어(`ㅊ무ㅅ`/`ㅊ무'ㅅ`/`ㅊ무ㅜ'ㅅ`→`can't`, `츤를`→`CMS를`, `눈를`→`SNS를` 등)를 추가하고, `sendWin32UnicodeReplacement`(`utils/win32-unicode-input.ts`)로 `(선택 Space) + N × VK_BACK + M × KEYEVENTF_UNICODE`를 **단일 `SendInput` 시스템콜(`< 0.5 ms`, 대기 `0 ms`)**로 원자적 주입하며, 타이핑 중 추가 입력된 꼬리 글자를 보존하는 델타 리베이싱(`rebaseTypoReplacementPlan`)을 구현했다. (3) `packages/ui`, `apps/web`, `apps/admin`, `apps/desktop/src/renderer`(메인·팝업 6종), `site/`, `apps/mobile-rn` 6개 표면을 전수 순회해 `design.md` 계약 위반을 모두 해소했다 (`npm run check:design` 0건).
|
||||
> Last update: 2026-10-29 — **v1.14.0 릴리스 + 포커스 전환 직후 첫 단어(`pc`/`ㅔㅊ`/`ㅖㅊ`/`내ㅔㅊ`) 한영 자동 전환(`INPUT-04`, `INPUT-19`) + 받아쓰기 구어·추임새·중복·동음이의어 후처리 정리 고도화(`AI-03`, `AI-05`).** (1) **포커스 클릭 직후 첫 단어(`pc` 등) 자동 전환:** `InputTelemetryService`에서 마우스 클릭(`_rebaseFocusText`)·창 전환 직후 첫 스냅샷(40~680 ms)이 찍히기 전에 사용자가 곧바로 친 첫 단어(`ㅔㅊ`, `ㅖㅊ` 등)가 `_textAtFocus` 기준선에 삼켜져 `editedSinceFocus = false`가 되던 문제를 `_typedInCurrentFocus`·`_lastTypedHwnd` 추적 및 첫 글자 키 입력 시 포그라운드 창 즉시 샘플링으로 해결하고, `@d3ro/core/typo-correction`에 대소문자 2글자 영문 약어(`ㅔㅊ`/`ㅖㅊ`→`PC`, `ㅐㄴ`/`ㅒㄴ`→`OS`, `ㅔㄱ`/`ㅖㄱ`→`PR`, `ㅊㅑ`→`CI`, `ㅍㅡ`→`VM`, `ㅔㅡ`/`ㅖㅡ`→`PM`, `ㅔㅐ`/`ㅖㅐ`→`PO`, `ㅗㄱ`→`HR`, `ㅑㄱ`→`IR`, `ㅇㅡ`→`DM`, `ㅡㅇ`→`MD`, `ㅔㅇ`/`ㅖㅇ`→`PD`, `ㅍㅔ`/`ㅍㅖ`→`VP`, `ㅠㅡ`→`BM`, `ㅆㅍ`→`TV`, `ㅑㅖ`→`IP`) 및 한글 접두+낱자모 합성어(`내ㅔㅊ`→`내PC`, `회사ㅔㅊ에서`→`회사PC에서`, `한글로ㅔㅊ라고`→`한글로PC라고`, `윈도우ㅐㄴ`→`윈도우OS`, `새ㅁㅔㅑ를`→`새API를`)를 추가했다. (2) **받아쓰기 구어·추임새·말바꾸기·중복·STT 동음이의어 정리:** `@d3ro/core/dictation-cleaner`(`cleanDictatedText`)를 신설해 `VoiceModeService._transcribe` 직후 지연 0 ms로 단독 추임새(`어`, `음`, `그 쓸데없는` 등 — 단 인용된 `어라든가`, `아라든가` 보존), 발화 중 말바꾸기(`검색 아니 검색이 아니라 타이핑을`→`타이핑을`), 상투적 중복(`쓸데없는 의미없는`→`불필요한`, `정리해 가지고 해 주는 거`→`정리해 주는 기능`), 구어 잉여 어미(`예를 들자면은`→`예를 들어`, `보면은`→`보면`), 문맥상 명백한 STT 동음이의어(`스시가 영어로 변경되지`→`PC가 영어로 변경되지`, `그 길을 쓸 이유가`→`그 기능을 쓸 이유가`)를 즉시 정리하고, `BASE_SYSTEM_PROMPTS.refine`(`llm-prompts.ts`), `MeetingModeService.polishTranscript`, 신규 내장 프리셋 `builtin-clean-speech`(`구어·추임새·중복 정리`, `CustomInstructionService.ts`)가 화자의 원래 어투(반말/해요체/합쇼체)를 바꾸지 않고 추임새·말바꾸기·중복·비문만 자연스럽게 다듬도록 업그레이드했다.
|
||||
>
|
||||
> Previous update: 2026-10-29 — **v1.13.0 릴리스 + 그래프 관계성 기반 극한 개인화(`INPUT-06`, `INPUT-20`) + 한영 형태론·전방 구문 감지 및 단일-시스콜 초고속 인플레이스 수정(`INPUT-19`, `INPUT-22`) + 전 표면 디자인파카(`designpaca`) 순회 감사(`SHELL-11`, `SHELL-15`).** (1) **그래프 관계성 & 극한 개인화:** `@d3ro/core/personal-graph` 및 `PersonalGraphService`에 앱별 연속 단문 메시지 간 세션 `follows` 체이닝(`_lastIndexedByScope`), 엔터 전송 직후 비워진 채팅창 문맥 복원(`recentWrites`), 증분 `shares_terms` 엣지 연결, 조사 차이 무관 어간 연속 이어쓰기(`stemContinuationsFrom`), 2-홉 그래프 경로 랭킹(`rankTwoHopGraphTargets`), 개인 그래프·어투 일치 기반 LLM 후보 재정렬(`scoreCandidatePersonalization`), 어간 바이그램 폴백 및 빈도 가중 개인 n-gram(`PersonalNgramModel`)을 추가했다(제안 노출 빈도는 그대로 유지). (2) **영어 감지 강화 & 초고속 타이핑 중 무경합 교정:** `@d3ro/core/typo-correction`에 확장 영어 어간(`EXTENDED_ENGLISH_STEMS`, `kubernetes`/`microsoft` 등)과 생산적 접두·접미 파생 형태론(`matchesInflectedOrDerivedEnglish`), 전방 영어 구문 호응(`새 ㅠㄷ `→`to be `, `새 애 this `→`to do this `, `랙 솓 `→`for the ` vs `오늘 새 API를 만들었어` 보존), 영어 축약형·약어(`ㅊ무ㅅ`/`ㅊ무'ㅅ`/`ㅊ무ㅜ'ㅅ`→`can't`, `츤를`→`CMS를`, `눈를`→`SNS를` 등)를 추가하고, `sendWin32UnicodeReplacement`(`utils/win32-unicode-input.ts`)로 `(선택 Space) + N × VK_BACK + M × KEYEVENTF_UNICODE`를 **단일 `SendInput` 시스템콜(`< 0.5 ms`, 대기 `0 ms`)**로 원자적 주입하며, 타이핑 중 추가 입력된 꼬리 글자를 보존하는 델타 리베이싱(`rebaseTypoReplacementPlan`)을 구현했다. (3) `packages/ui`, `apps/web`, `apps/admin`, `apps/desktop/src/renderer`(메인·팝업 6종), `site/`, `apps/mobile-rn` 6개 표면을 전수 순회해 `design.md` 계약 위반을 모두 해소했다 (`npm run check:design` 0건).
|
||||
>
|
||||
> Previous update: 2026-10-27 — **v1.11.0 릴리스 + Araso 방식 한영 자동 변환·터미널/Vim/xterm.js 지원 완성 (`INPUT-19`, `GAP-INPUT-08`).** `nyttastudio/araso`를 분석해 `@d3ro/core/araso-layout` 및 `@d3ro/core/typo-correction`을 대폭 업그레이드하고 터미널·Vim·xterm.js(`Agent Switchboard`)까지 확장했다: 영어·약어·CamelCase+한국어 조사/단어 혼합어 분리(`githubdp`→`github에`, `PDFvkdlf`/`ㅖㅇㄹ파일`→`PDF파일`, `Reactzjavhsjsxm`→`React컴포넌트`, `dhsmfdmsgoogledptj`→`오늘은google에서`, `1:1ansdml`→`1:1문의`, 2글자 약어 받침 호응 `TMdms`→`TM은` vs `TMsms`→`쓰는`), 쌍자음 잔여 Shift 정규화(`djEJs`→`어떤`, `qkRNjTdj`→`바꿨어`), 한글 자판 상태 영어/혼합어 역변환(`ㅗ디ㅣㅐ 재깅`→`hello world`, `내ㅡㄷ샤ㅡㄷ`→`sometime`, `ㅎ샤ㅗㅕㅠ에`→`github에`, `ㅠㅕㅎ가`→`bug가`, 알파벳+조사 `ㄴ가`→`s가`, `ㄴ은`→`s은`), 문장 문맥 한영 전환(`Stay hungry, stay foolishsms wkqtmdml akfdlek.`), URL·경로·이메일 보호(`isUrlOrPathRun`), 터미널·Vim 명령(`:ㅈㅂ`→`:wq`, `:ㅂ!`→`:q!`, `퍄ㅡ `→`vim `, Vim 노멀 모드 교정 억제), `SendInput(KEYEVENTF_UNICODE)` 직접 유니코드 타이핑(클립보드 무접촉), 단어 경계(`25ms`)와 어절 내부(`650ms`) 유휴 분리 및 완성형 음절(`[가-힣]`) 한정 `commitComposition`으로 고속 타이핑 시 글자 삼킴·유령 공백·앞글자 중복을 완전히 해소했다. 통계 수집 동의(`inputTelemetryEnabled`)가 꺼져 있어도 기본 기능(`typoAutoCorrectEnabled: true`)으로 즉시 동작한다.
|
||||
>
|
||||
|
|
@ -13,7 +15,7 @@
|
|||
> Previous update: 2026-09-22 — **Gemma/Ollama 폭주 방어 계약을 기록했다.** 19:14:12 부팅 워밍업이 `keep_alive: 30m`으로 `gemma4:e4b`를 19:44:12까지 VRAM 3,226,342,521 bytes / context 4096으로 강제 상주시킨 것이 관측됐으며, 같은 시점 Windows GPU Engine PID 표본에는 Ollama의 활성 compute가 없었다. 즉 당시 상태는 무한 추론이 아니라 강제 residency였다. 19:11:17~19:11:58의 자동 제안 연속 생성은 기존 900 ms·12/min·5 candidates·128 tokens·한 글자 재생성 정책이 허용한 burst였다. 현재 구현 계약은 부팅 warmup 제거, `keep_alive: 2m`, 제안 600 ms / 최소 5 s 간격 / 기본 6회·hard max 12회 per min / 3 candidates / 64 tokens / 12-char growth / 8 s timeout, 그리고 요청별 취소·상한·종료 정리다. 독립 표적 검증은 6 test files / 69 tests passed / 0 failed, 변경 코드·테스트 ESLint와 `git diff --check`도 exit 0이다. Raw Ollama에서는 cold bounded 요청이 client hard timeout 15.044 s에 취소된 뒤 `/api/ps`가 비었고 `/api/version`은 80 ms에 회복했다. 명시 warmup은 HTTP 200 / 16.639 s, 후속 warm 요청은 body `options.num_predict=1`, `keep_alive='2m'`로 553 ms HTTP 200 / `done:true` / `eval_count:1` / `done_reason:length`였고 `/api/ps` expiry는 약 119.9 s였다. **19:48:59 +09:00에는 새 generate/unload/kill/retry 없이 충분히 지난 뒤 한 번의 `/api/ps`가 HTTP 200 / 45.8 ms / `{models:[]}`였고 `/api/version`은 HTTP 200 / 7.3 ms / `0.32.13`이었다.** 이는 raw API 수준의 expiry 뒤 unload 확인일 뿐 앱 재시작·GUI·실제 타이핑 증거는 아니므로 상태는 `[~]`로 유지한다 (`11` GAP-LLM-04, GAP-INPUT-06).
|
||||
>
|
||||
> Previous update: 2026-09-21 — **Input intelligence (입력 레메트리 + 다음 문장 제안) 신규**. 데스크톱에 입력 수집기(`InputTelemetryService`), UIA 컨텍스트 브리지(사이드카 `GET /uia/focus`), 제안 서비스(`SuggestionService`), 어렛 커 오버레이, 설정 > 입력 탭(동의·정책·주간 인사이트·개인 문구)을 추가했다. 카탈로그에 `INPUT-01`~`INPUT-08`(전부 데스크톱 `[~]` — 유닛 48건은 GREEN 이지만 **실앱 타이핑 검증 전**), 백로그에 GAP-INPUT-01~05 + GAP-LLM-03, §7 에 CONSTRAINT-INPUT-01(키 내용 미저장 — ActivityWatch 정책 채택)을 기록. 설계 근거는 조사 기반이다: 어렛은 `GetGUIThreadInfo` 가 아니라 UIA `TextPattern.GetSelection`(Chromium 은 `TextPattern2` 미구현), 타이핑 스트는 키코드 복원이 아니라 UIA 스냅샷 diff(한/일 IME 대응), 디바운스/토큰 한도는 인라인 컴플리션 실측값(Continue 350 / Tabby 250 / twinny 300 ms, 출력 64~256 토큰). 의존성: `koffi` 3.3.1(포그라운드 창 FFI), 사이드카 `uiautomation` 2.0.29 + `comtypes`. 데스크톱 유닛 총계 1409(+49), Electron ABI 실행에서 신규 실패 0건. 당시의 24.7초/4.9초 지연 설명과 `keep_alive: 30m`·부팅 워밍업 처방은 **현재 상태가 아닌 과거 가설/완화 이력**이며, 최신 운영 결론은 위 2026-09-22 항목과 `11` GAP-LLM-04를 따른다. 직전: LLM instruction-prompt fix (`9c2b4d4`): the custom-instruction path inserted the instruction's own wording instead of the processed result and had **never worked in any shipped release** (`v0.1.0-alpha`..`v1.4.0`, introduced `fea923d` 2026-04-05, not a regression). `llm-prompts.ts` is now the SSOT for prompt resolution and placeholder substitution, shared by `VoiceModeService` / `ChainService` / `LLM.PROCESS`. AI-04/05/06/07 are demoted to `[~]` on desktop — fixed with unit tests, but **not verified in a running app** and the four related `tests/red/*.usecase.test.ts` could not execute (`better-sqlite3` ABI). New: GAP-LLM-01 (no target-language setting), GAP-LLM-02 (this fix unverified); GAP-INFRA-06 amended (the ABI masks verification, not just dev-env switching cost); GAP-I18N-01 amended (`popup.error.default` missing in 10 locales). Earlier the same day: CAP-16 (desktop key bindings rebuilt on one `@d3ro/core/keybinding` SSOT — multiple bindings per action, mouse buttons, `HOTKEY` → `KEYBINDING` IPC group), verified on Windows by a manual run, so CAP-16 and CAP-02 are `[x]` and GAP-KEY-01 is closed. Still open: GAP-KEY-02/03, GAP-QA-02, GAP-I18N-01/02, GAP-INFRA-06, GAP-LLM-01/02, GAP-INPUT-01~05; `11` §7 holds accepted design constraints (things deliberately kept, not gaps)
|
||||
> Scope: entire monorepo `D:/workspace/D3ROVoice` at product version `1.13.0` (`release/product-version.json`, released 2026-10-29)
|
||||
> Scope: entire monorepo `D:/workspace/D3ROVoice` at product version `1.14.0` (`release/product-version.json`, released 2026-10-29)
|
||||
> Purpose: let any agent (or human) answer two questions in under a minute:
|
||||
> 1. **What infrastructure exists?** (build, CI, services, APIs, data, packages, deploy)
|
||||
> 2. **How far is each feature developed?** (per surface, with file anchors and status)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ The canonical place for types and cross-surface logic. Both desktop and web/mobi
|
|||
| IPC channels | `./ipc-channels` | `IPC_CHANNELS` object + `IPCChannel` union. **SSOT** for every desktop IPC channel (VOICE, AUDIO, STT, TTS, LLM, KEYBINDING, CONFIG, HISTORY, UNIFIED_SEARCH, DICTIONARY, WINDOW, SYSTEM, STATS, MEMO, VOICE_COMMAND, CONTEXT, CHAIN, CAPTION, FILE_TRANSCRIPTION, MEETING_SUMMARY, DICTATION_TEMPLATE, VOICE_CONVERSATION, RAG, VOICE_ACTION, MEETING_MODE, MEETING_DOC_TEMPLATE, MEETING_CHAT, LICENSE, CLOUD_SYNC, INSTRUCTION, SYSTEM_AUDIO, POPUP_RESULT, POPUP_HISTORY, POPUP_COMMAND, POPUP_CAPTION, VOICE_PARTIAL, CLIPBOARD, APP, ONLINE_AUTH, ADS, SUPPORT, INPUT_TELEMETRY, SUGGESTION, POPUP_SUGGESTION) |
|
||||
| Key bindings | `./keybinding` | **SSOT** for every global shortcut in the app: `KeyBinding` (`device`/`code`/`ctrl`/`alt`/`shift`/`meta`), `KEY_CATALOG` (10 selectable groups incl. mouse), `KEYBINDING_ACTIONS` (9 rebindable actions incl. the three suggestion actions), `bindingKey`/`normalizeBinding`/`validateBinding`/`detectBindingConflicts`/`formatBindingSegments`/`searchKeyCatalog`/`parseBindingMap`. Persisted as `AppConfig.keyBindings`. i18n keys are exposed as plain `string` so core stays independent of `@d3ro/i18n`; consumers narrow at the boundary (`asTranslationKey`) and a contract test guards the keys — accepted constraint, `11` §7 CONSTRAINT-I18N-01. Tests: `__tests__/keybinding*.test.ts` via `vitest.config.ts` (`npm run test --workspace=@d3ro/core`), 117 cases as of 2026-09-21 |
|
||||
| Input intelligence | `./input-intelligence` | **SSOT** for the input-telemetry and next-sentence-suggestion domain (added 2026-09-21): key classification (`classifyKeyStroke`), text metrics (`countWords`/`countSentences`/`endsSentence`/`textBeforeCaret`), `computeTypedDelta` (UIA snapshot diff — the IME-safe way to count typed text), `decideSuggestion` + `isAppExcluded` (when to request / skip / clear), `parseSuggestionCandidates`/`sanitizeSuggestionLine` (prompt-leak and prefix-echo defence), `anchorFloatingPanel` (caret-anchored overlay placement), `mergeActivityBucket`/`summarizeActivity`/`pixelsToMeters`, `extractPhrases`/`selectPhraseHints`, `INPUT_TELEMETRY_DEFAULTS`/`SUGGESTION_DEFAULTS` |
|
||||
| Typo correction & Araso layout | `./typo-correction`, `./araso-layout` | **SSOT** for built-in automatic Han/Eng conversion and typo auto-correction (upgraded 2026-10-28): 2-set Korean/English layout conversion (`engToHangul`/`hangulToEng`), productive English derivational prefixes/suffixes (`matchesInflectedOrDerivedEnglish`, `EXTENDED_ENGLISH_STEMS`), phrase-level lookahead English detection (`TO_FOLLOWING_ENGLISH_WORDS`, `resolveTokenAsEnglishPreview`), lingering Shift normalization (`normalizeLingeringShift`/`lingersAfterKoreanShift`), mixed-word splitting with Korean particle batchim agreement (`splitMixedWord`/`particleAgrees`), reverse Hangul-to-English/mixed restoration, URL/path/email run protection (`isUrlOrPathRun`), deterministic spelling & jamo-noise rules (`detectTypos`/`detectJamoNoise`), delta-rebasing for in-flight typing (`rebaseTypoReplacementPlan`), and LLM typo validation (`validateModelCorrections`). |
|
||||
| Typo correction & Araso layout | `./typo-correction`, `./araso-layout` | **SSOT** for built-in automatic Han/Eng conversion and typo auto-correction (upgraded 2026-10-29): 2-set Korean/English layout conversion (`engToHangul`/`hangulToEng`), shifted/unshifted 2-letter loose-jamo acronyms (`ㅔㅊ`/`ㅖㅊ`→`PC`, `ㅐㄴ`/`ㅒㄴ`→`OS`, `ㅔㄱ`/`ㅖㄱ`→`PR`, `ㅊㅑ`→`CI`, `ㅍㅡ`→`VM`, `ㅔㅡ`→`PM`, `ㅔㅐ`→`PO`, `ㅗㄱ`→`HR`, `ㅑㄱ`→`IR`, `ㅇㅡ`→`DM`, `ㅡㅇ`→`MD`, `ㅔㅇ`→`PD`, `ㅍㅔ`→`VP`, `ㅠㅡ`→`BM`, `ㅆㅍ`→`TV`, `ㅑㅖ`→`IP`) and Korean-prefix + loose-jamo compounds (`내ㅔㅊ`→`내PC`, `회사ㅔㅊ에서`→`회사PC에서`, `한글로ㅔㅊ라고`→`한글로PC라고`), productive English derivational prefixes/suffixes (`matchesInflectedOrDerivedEnglish`, `EXTENDED_ENGLISH_STEMS`), phrase-level lookahead English detection (`TO_FOLLOWING_ENGLISH_WORDS`, `resolveTokenAsEnglishPreview`), lingering Shift normalization (`normalizeLingeringShift`/`lingersAfterKoreanShift`), mixed-word splitting with Korean particle batchim agreement (`splitMixedWord`/`particleAgrees`), reverse Hangul-to-English/mixed restoration, URL/path/email run protection (`isUrlOrPathRun`), deterministic spelling & jamo-noise rules (`detectTypos`/`detectJamoNoise`), delta-rebasing for in-flight typing (`rebaseTypoReplacementPlan`), and LLM typo validation (`validateModelCorrections`). |
|
||||
| Dictation cleaner | `./dictation-cleaner` | **SSOT** for deterministic zero-latency speech disfluency & dictation cleanup (`cleanDictatedText`, added 2026-10-29): strips standalone spoken fillers (`어`, `음`, `그 쓸데없는` while preserving quoted mentions like `어라든가`, `아라든가` and demonstratives), mid-sentence self-corrections (`X 아니 X이 아니라 Y` → `Y`), word stutters (`내가 내가` → `내가`), colloquial suffixes (`예를 들자면은` → `예를 들어`, `보면은` → `보면`), redundant expressions (`쓸데없는 의미없는` → `불필요한`), and clear contextual STT homophones (`스시가 영어로 변경되지` → `PC가 영어로 변경되지`, `그 길을 쓸 이유가` → `그 기능을 쓸 이유가`) while preserving speaker register. |
|
||||
| Personal graph & n-gram | `./personal-graph`, `./personal-ngram` | **SSOT** for relational personalization and n-gram continuation (upgraded 2026-10-28): exact & particle-invariant stemmed continuations (`continuationsFrom`/`stemContinuationsFrom`), IDF-weighted related node scoring (`scoreRelatedNodes`), 2-hop graph path ranking (`rankTwoHopGraphTargets` across `shares_terms→follows` and `follows→follows`), personalized candidate reranking (`scoreCandidatePersonalization`), and frequency-weighted n-gram indexing with Korean stemmed-word bigram fallback (`PersonalNgramModel`). |
|
||||
| Constants | `./constants` | Shared constants |
|
||||
| Crypto license | `./utils/crypto-license` | Ed25519 license sign/verify (used by admin issuer + desktop verifier) |
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ Singleton + `EventEmitter` pattern (`getXService()` accessors).
|
|||
### Input intelligence (2026-09-21; Local Flow Intelligence extension 2026-09-22)
|
||||
| Service / file | Purpose |
|
||||
|---|---|
|
||||
| `InputTelemetryService` | Global input telemetry and context observer: keystroke/click/scroll counters, mouse travel (Manhattan sum of per-axis deltas), active time, per-hour-per-app buckets flushed every 5 s; typed-text learning via UIA snapshot diffs. **Since 2026-10-26**, the UIA context observer runs by default whenever `typoAutoCorrectEnabled !== false` (or `suggestionEnabled === true`), while SQLite `input_activity` persistence only runs when `inputTelemetryEnabled === true` (opt-in). **Since 2026-10-27**, includes `TerminalKeystrokeTracker` (`@d3ro/core/input-intelligence`) + `isForegroundKoreanIme` (`utils/win32-foreground.ts`) to reconstruct the active terminal/Vim line (`reconcileWithScreen` for UIA screen buffers like Windows Terminal/pwsh/cmd, `reconcileWithXtermValue` for `xterm.js` `<textarea class="xterm-helper-textarea">` controls in Agent Switchboard/VS Code/Cursor where `.value` stays populated until Enter/Ctrl+C, and `getSnapshot` for canvas/remote terminals with `len=0` like Kitedesk/WezTerm/Alacritty), preserving trailing spaces stripped by grid terminals and tracking Vim modes (`insert`, `normal`, `command`). Programmatic keys (`_programmaticKeys`) no longer advance `_lastKeyAt`, and `Enter`-triggered chat submissions that clear or shrink the input field rebase focus text immediately so cleared/toolbar text does not trigger post-send suggestions. It extends the telemetry store with Flow Radar (hourly activity density + chars + edit stability; a potential-focus score, **not** a real session), Edit Friction (chars/backspaces; edits per 100 chars), App Quality (per-app suggestion total/accepted/accept rate/average latency), Privacy Receipt (actual row counts and retention), and Smart Exclusion evidence. Raw key events, key codes and content streams are never retained; separately, opt-in learned text may be retained in `typing_samples` and `personal_phrases` under the stated receipt policy. |
|
||||
| `InputTelemetryService` | Global input telemetry and context observer: keystroke/click/scroll counters, mouse travel (Manhattan sum of per-axis deltas), active time, per-hour-per-app buckets flushed every 5 s; typed-text learning via UIA snapshot diffs. **Since 2026-10-26**, the UIA context observer runs by default whenever `typoAutoCorrectEnabled !== false` (or `suggestionEnabled === true`), while SQLite `input_activity` persistence only runs when `inputTelemetryEnabled === true` (opt-in). **Since 2026-10-27**, includes `TerminalKeystrokeTracker` (`@d3ro/core/input-intelligence`) + `isForegroundKoreanIme` (`utils/win32-foreground.ts`) to reconstruct the active terminal/Vim line (`reconcileWithScreen` for UIA screen buffers like Windows Terminal/pwsh/cmd, `reconcileWithXtermValue` for `xterm.js` `<textarea class="xterm-helper-textarea">` controls in Agent Switchboard/VS Code/Cursor where `.value` stays populated until Enter/Ctrl+C, and `getSnapshot` for canvas/remote terminals with `len=0` like Kitedesk/WezTerm/Alacritty), preserving trailing spaces stripped by grid terminals and tracking Vim modes (`insert`, `normal`, `command`). Programmatic keys (`_programmaticKeys`) no longer advance `_lastKeyAt`, and `Enter`-triggered chat submissions that clear or shrink the input field rebase focus text immediately so cleared/toolbar text does not trigger post-send suggestions. **Since 2026-10-29**, tracks `_typedInCurrentFocus` and `_lastTypedHwnd` and forces immediate foreground sampling on the first keystroke after a mouse click (`_rebaseFocusText`) or window switch, so typing `pc` (`ㅔㅊ`) immediately after clicking into a search box or new field sets `editedSinceFocus = true` on the very first snapshot. It extends the telemetry store with Flow Radar (hourly activity density + chars + edit stability; a potential-focus score, **not** a real session), Edit Friction (chars/backspaces; edits per 100 chars), App Quality (per-app suggestion total/accepted/accept rate/average latency), Privacy Receipt (actual row counts and retention), and Smart Exclusion evidence. Raw key events, key codes and content streams are never retained; separately, opt-in learned text may be retained in `typing_samples` and `personal_phrases` under the stated receipt policy. |
|
||||
| `TypoCorrectionService` | Built-in automatic Han/Eng layout conversion and typo auto-correction (`INPUT-19`). Runs on each `typed-context`: Araso-style layout conversions (`source: 'layout'`) fire after 25 ms on word boundaries (Space/punctuation, 40 ms quick snapshot) or 135 ms at token tail (150 ms quick snapshot, even when Chromium/Discord keeps `isComposing=true`, committing IME composition first only when the trailing character is Hangul/jamo), replacing 2-set Han/Eng layout errors, mixed English+Korean words (`githubdp`→`github에`, `PDFvkdlf`→`PDF파일`, `ㅖㅇㄹ파일`→`PDF파일`), lingering Shift on double consonants (`djEJs`→`어떤`), reverse Hangul-to-English (`ㅎ샤ㅗㅕㅠ에`→`github에`, `ㅑㄹ ㅑ 쇼ㅔㄷ ㅗ디ㅣㅐ 소두 ㅑㅅ 초뭏ㄷㄴ ㅑㅜ 10 ㄴㄷ채ㅜㅇㄴ`→`if I type hello then it changes in 10 seconds`), lookahead English clauses (`새 ㅠㄷ `→`to be `, `새 애 this `→`to do this `), and partially-converted tokens (`안녕gktpdy`→`안녕하세요`). **In terminals and Vim (`terminalMode: true`)**, layout-only conversion stays active while spelling/model checks are suppressed: converts CLI commands (`퍄ㅡ `→`vim `, `ㅜ퍄ㅡ `→`nvim `, `ㅎ샤 `→`git `, `ㅣㄴ `→`ls `, `채ㅜㄴㅅ `→`const `), Vim Insert-mode typing (stripping leading `i/a/o/I/A/O/s/S` mode-entry keys when present in raw keystroke buffers), and Vim Command-line ex-commands (`:ㅈㅂ`→`:wq`, `:ㅈㅂ!`→`:wq!`, `:ㅈ`→`:w`, `:ㅂ`→`:q`, `:ㅂ!`→`:q!`, `:ㅌ`→`:x`, `:ㅍ네`→`:vsp`, `:네`→`:sp`, `:ㅜㅐㅗ`→`:noh`, preserving `:`), while blocking all conversions in Vim Normal mode (`vimMode === 'normal'`). **Since 2026-10-28**, on Windows, `TextInsertService.replaceBeforeCaret` (`method === 'keyboard'`) executes an atomic single-syscall `sendWin32UnicodeReplacement` (`utils/win32-unicode-input.ts`) packing `(optional VK_SPACE) + N × VK_BACK + M × KEYEVENTF_UNICODE` into one `SendInput` call (`<0.5 ms`, zero JS sleep, zero clipboard access), and `TypoCorrectionService` delta-rebases replacement plans (`rebaseTypoReplacementPlan`) when the user appends characters while an async snapshot or LLM check is in flight. Both Stage 1 (deterministic layout/spelling) and Stage 2 (tail-anchored `trailingWordOnly: true` Gemma check) run seamlessly even when `SuggestionService` is enabled. |
|
||||
| `UiaContextService` | Client for the sidecar UIA bridge (`GET /uia/focus`): focused text, caret rect/offset, `IsPassword`, IME composition state and `hasSelection`. The sidecar derives `hasSelection` only by comparing the TextPattern selection range Start/End endpoints: it does not call `GetText` on that range or add a separate selected-text payload (the existing focused-field text can still include a selection). Fail-closed on password/unavailable; transient failures back off for 1.5/3/6/12/30 s and permanent failures for 5 min. |
|
||||
| `SuggestionService` | Next-sentence ghost text: 600 ms debounce, then `buildSuggestionPrompt` → `LocalLLMService.streamGenerate` with a caller-owned `AbortSignal` → candidate ranking and accept (via `TextInsertService`). Presentation-active includes candidates plus `generating`, `warmingUp` and `partialText`; clear/dismiss aborts the active request, invalidates its generation token, clears TTL state, then emits `cleared`/hide so a spinner-only popup closes. A successful final candidate payload resets `generating=false` and `partialText=null`. App DNA extends phrase ranking with `appName` context and a 1.75× same-app bonus; Memory Decay uses a 30-day half-life plus frequency. Why This Suggestion exposes only `local-model`/`local-memory` provenance and continuation/related/phrase/appPhrase **counts** to the overlay, never raw evidence text. Instant Recall uses local-memory provenance without another model-budget spend only when the model is unavailable, raises a non-cancellation error, truly times out, or returns empty; it never publishes after dismiss, new typing, token/context mismatch or staleness. Its runaway limits are a 5 s minimum interval, 6 requests/min default (hard-config maximum 12), 3 candidates, 64 output tokens, 12-character regeneration growth and an 8 s timeout; app startup does not warm the model and suggestion requests use `keep_alive: 2m`. |
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
34
packages/core/__tests__/dictation-cleaner.test.ts
Normal file
34
packages/core/__tests__/dictation-cleaner.test.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import { cleanDictatedText } from '../src/dictation-cleaner'
|
||||
|
||||
describe('cleanDictatedText (받아쓰기 추임새·말바꾸기·중복·동음이의어 결정적 정리)', () => {
|
||||
it('말하다가 즉시 고쳐 말한 자기 수정(검색 아니 검색이 아니라 타이핑을)과 추임새·중복을 정리하고 원래 반말 어조를 유지한다', () => {
|
||||
const raw =
|
||||
'예를 들자면은 pc라고 한글로 검색 아니 검색이 아니라 타이핑을 했을 때 pc라고 타이핑하면은 스시가 영어로 변경되지 않아'
|
||||
expect(cleanDictatedText(raw)).toBe(
|
||||
'예를 들어 PC라고 한글로 타이핑하면 PC가 영어로 변경되지 않아'
|
||||
)
|
||||
})
|
||||
|
||||
it('단독 추임새(어, 음, 그 쓸데없는)는 제거하되 인용된 어라든가·아라든가와 지시관형사 그는 보존한다', () => {
|
||||
const raw =
|
||||
'그 후처리 효과 근데 후처리 같은 것들도 보면은 어 어라든가 아니면 아라든가 그 쓸데없는 의미없는 다른 것들이라든지 어 중복된 거라든지 이런 것들 다 정리해 주는 것들은 없거든'
|
||||
expect(cleanDictatedText(raw)).toBe(
|
||||
'그 후처리 효과 근데 후처리 같은 것들도 보면 어라든가 아니면 아라든가 불필요한 다른 것들이라든지 중복된 거라든지 이런 것들 다 정리해 주는 것들은 없거든'
|
||||
)
|
||||
})
|
||||
|
||||
it('연속 동일 어절 말더듬은 한 번으로 줄이되 의도적 부사 반복(조금 조금, 천천히 천천히)은 유지한다', () => {
|
||||
expect(cleanDictatedText('어 지금 내가 내가 받아쓰기 하는 것도 있잖아')).toBe(
|
||||
'지금 내가 받아쓰기 하는 것도 있잖아'
|
||||
)
|
||||
expect(cleanDictatedText('조금 조금 천천히 천천히 진행하자')).toBe(
|
||||
'조금 조금 천천히 천천히 진행하자'
|
||||
)
|
||||
})
|
||||
|
||||
it('감탄사 한 글자만 말한 경우 빈 문자열로 만들지 않고 원문을 보존한다', () => {
|
||||
expect(cleanDictatedText('어')).toBe('어')
|
||||
expect(cleanDictatedText('음')).toBe('음')
|
||||
})
|
||||
})
|
||||
|
|
@ -711,4 +711,17 @@ describe('Araso 급 한/영 자동 전환 · 합성어 · 잔류 Shift · URL
|
|||
})
|
||||
expect(rebaseTypoReplacementPlan(base!, 'ㅡㅁ가둥', '전혀다른문장', 18)).toBeNull()
|
||||
})
|
||||
|
||||
it('PC·OS·PR·PM·PO 등 2글자 호환 자모 약어(Shift 포함)와 한글 접두+자모 약어 합성어(내ㅔㅊ, 회사ㅔㅊ에서, 한글로ㅔㅊ라고)를 즉시 복원한다', () => {
|
||||
expect(applyAll('ㅔㅊ')).toBe('PC')
|
||||
expect(applyAll('ㅖㅊ')).toBe('PC')
|
||||
expect(applyAll('ㅔㅊ ')).toBe('PC ')
|
||||
expect(applyAll('ㅔㅊ에서 ')).toBe('PC에서 ')
|
||||
expect(applyAll('ㅔㅊ라고 ')).toBe('PC라고 ')
|
||||
expect(applyAll('내ㅔㅊ ')).toBe('내PC ')
|
||||
expect(applyAll('회사ㅔㅊ에서 ')).toBe('회사PC에서 ')
|
||||
expect(applyAll('한글로ㅔㅊ라고 ')).toBe('한글로PC라고 ')
|
||||
expect(applyAll('윈도우ㅐㄴ ')).toBe('윈도우OS ')
|
||||
expect(applyAll('새ㅁㅔㅑ를 ')).toBe('새API를 ')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -50,6 +50,10 @@
|
|||
"types": "./src/araso-layout.ts",
|
||||
"default": "./src/araso-layout.ts"
|
||||
},
|
||||
"./dictation-cleaner": {
|
||||
"types": "./src/dictation-cleaner.ts",
|
||||
"default": "./src/dictation-cleaner.ts"
|
||||
},
|
||||
"./caption-streaming": {
|
||||
"types": "./src/caption-streaming.ts",
|
||||
"default": "./src/caption-streaming.ts"
|
||||
|
|
|
|||
136
packages/core/src/dictation-cleaner.ts
Normal file
136
packages/core/src/dictation-cleaner.ts
Normal file
|
|
@ -0,0 +1,136 @@
|
|||
// packages/core/src/dictation-cleaner.ts
|
||||
// 음성 받아쓰기(STT) 구어 군더더기·추임새·말바꾸기·중복·동음이의어 결정적 정리기 (순수 함수).
|
||||
//
|
||||
// LLM 후처리가 꺼져 있거나(none) 로컬 LLM 연결이 안 된 상태에서도 지연 시간(0ms) 없이
|
||||
// 화자의 원래 말투(반말/해요체/합쇼체)를 100% 보존하면서:
|
||||
// 1. 무의미한 추임새·간투사('어', '음', '흠', '아 그', '어 그', 'uh', 'um' 등) 제거
|
||||
// (단, '어라든가', '아라든가' 처럼 추임새 자체를 언급한 인용 표현은 보존)
|
||||
// 2. 말하다가 즉시 고쳐 말한 자기 수정('검색 아니 검색이 아니라 타이핑을' → '타이핑을') 정리
|
||||
// 3. 연속 말더듬('내가 내가', '어 어', '그 그') 및 의미 중복('쓸데없는 의미없는' → '불필요한') 축약
|
||||
// 4. 구어체 잉여 보조사('예를 들자면은' → '예를 들어', '타이핑하면은' → '타이핑하면') 정리
|
||||
// 5. 문맥상 명백한 STT 동음이의어 오인식('pc라고 타이핑하면 스시가 영어로' → 'PC라고 타이핑하면 PC가 영어로') 교정
|
||||
|
||||
/** 의도적 강조·부사 반복으로 유지해야 하는 어절 */
|
||||
const INTENTIONAL_REDUPLICATIONS: ReadonlySet<string> = new Set([
|
||||
'조금',
|
||||
'하나',
|
||||
'하루',
|
||||
'차근',
|
||||
'천천히',
|
||||
'매우',
|
||||
'정말',
|
||||
'진짜',
|
||||
'너무',
|
||||
'자주',
|
||||
'많이',
|
||||
'빨리',
|
||||
'점점',
|
||||
'다들',
|
||||
'각각',
|
||||
'사사',
|
||||
'건건'
|
||||
])
|
||||
|
||||
/** 지시관형사 '그'(that)가 수식할 수 없는 부사·대명사·접속사·수식어 — 앞의 단독 '그'는 추임새다 */
|
||||
const NON_MODIFIABLE_AFTER_GEU =
|
||||
/^(?:내가|나는|나도|우리|제가|저는|지금|일단|예를|그래서|그런데|근데|그리고|혹시|이제|약간|막|좀|참|원래|사실|어차피|아무튼|어쨌든|쓸데없는|의미없는|불필요한)/u
|
||||
|
||||
/**
|
||||
* 받아쓰기 전사 원문에서 추임새, 말 바꾸기, 어절 중복, 구어 군더더기, 문맥상 명백한 STT 오인식을
|
||||
* 화자의 원래 말투(반말·존댓말)를 바꾸지 않고 정리한다.
|
||||
*
|
||||
* 정리 결과가 빈 문자열이 되면(예: 사용자가 감탄사 한 글자만 말한 경우) 원문 trim 결과를 그대로 돌려준다.
|
||||
*/
|
||||
export function cleanDictatedText(text: string): string {
|
||||
const original = text.trim()
|
||||
if (!original) return text
|
||||
|
||||
let cleaned = original
|
||||
|
||||
// 1. 말 바꾸기 / 자기 수정 (Self-correction):
|
||||
// "검색 아니 검색이 아니라 타이핑을" → "타이핑을"
|
||||
// "내일 아니 내일이 아니라 모레" → "모레"
|
||||
cleaned = cleaned.replace(
|
||||
/([가-힣A-Za-z0-9]{1,12})(?:이|가|은|는|을|를|도|로|에서|에)?\s+아니(?:아니)?\s+\1(?:이|가|은|는|을|를|도|로|에서|에)?\s+아니라\s+/gu,
|
||||
''
|
||||
)
|
||||
// "내일 아 아니 모레" / "검색 아니아니 타이핑" / "3시 아니 잠깐만 4시" → 취소한 앞 어절 제거
|
||||
cleaned = cleaned.replace(
|
||||
/([가-힣A-Za-z0-9]{1,10})\s+(?:아\s+아니|어\s+아니|아니아니|아니\s+참|아니\s+잠깐만?)\s+/gu,
|
||||
''
|
||||
)
|
||||
|
||||
// 2. 복합 추임새 사슬 먼저 제거 ("어 그", "음 그", "아 그", "어 음", "음 어", "아 어", "어 아")
|
||||
cleaned = cleaned.replace(
|
||||
/(?:^|(?<=\s))(?:어|음|흠|아|에)\s+(?:그|어|음|흠|아)(?=\s)/gu,
|
||||
''
|
||||
)
|
||||
|
||||
// 3. 단독 추임새 제거 ('어', '음', '흠', '어어', '음음', '아아', '저기')
|
||||
// 단, '어라든가', '아라든가' 처럼 조사가 붙은 어절은 공백 경계(?=\s)에 걸리지 않으므로 안전하게 보존된다.
|
||||
cleaned = cleaned.replace(
|
||||
/(?:^|(?<=\s))(?:어+|음+|흠+|에+|저기)(?:[,.…]+)?(?=\s)/gu,
|
||||
''
|
||||
)
|
||||
// 문장 중간의 단독 감탄형 추임새 '아' (뒤에 공백이 이어지고 인용/호격이 아닌 경우)
|
||||
cleaned = cleaned.replace(
|
||||
/(?<=[가-힣]\s)아(?=\s+[가-힣A-Za-z0-9])/gu,
|
||||
''
|
||||
)
|
||||
// 영문 추임새 (uh, um, erm, hmm)
|
||||
cleaned = cleaned.replace(/\b(?:uh+|um+|erm+|hmm+)\b[,.]?\s*/giu, '')
|
||||
|
||||
// 4. 지시관형사가 될 수 없는 자리의 추임새 '그' 제거 (예: "그 쓸데없는", "그 내가", "그 지금")
|
||||
cleaned = cleaned
|
||||
.split(/\s+/u)
|
||||
.filter((token, idx, arr) => {
|
||||
if (token !== '그') return true
|
||||
const next = arr[idx + 1]
|
||||
if (!next) return false
|
||||
if (next === '그') return false
|
||||
if (NON_MODIFIABLE_AFTER_GEU.test(next)) return false
|
||||
return true
|
||||
})
|
||||
.join(' ')
|
||||
|
||||
// 5. 연속 동일 어절 말더듬 축약 ("내가 내가" → "내가", "지금 지금" → "지금")
|
||||
cleaned = cleaned.replace(
|
||||
/(?:^|(?<=\s))([가-힣A-Za-z0-9]{1,10})\s+\1(?=\s|$|[,.?!])/gu,
|
||||
(full, word: string) => (INTENTIONAL_REDUPLICATIONS.has(word) ? full : word)
|
||||
)
|
||||
|
||||
// 6. 구어 잉여 어미 및 상투적 중복 구절 정리
|
||||
cleaned = cleaned
|
||||
.replace(/예를\s*들자면은?/gu, '예를 들어')
|
||||
.replace(/([가-힣]{0,12}(?:하|보|오|가|나|쓰|치|두|주|트|키|열|닫|되|이|있|없|같|싶|자)면)은(?=\s|$|[,.?!])/gu, '$1')
|
||||
.replace(/([가-힣]{1,12})거든\s+요(?=\s|$|[,.?!])/gu, '$1거든요')
|
||||
.replace(/(?:쓸데없는\s+의미\s*없는|의미\s*없는\s+쓸데없는)/gu, '불필요한')
|
||||
.replace(/정리해\s*가지고\s+해\s*주는\s+거/gu, '정리해 주는 기능')
|
||||
.replace(/그럼\s+(기능들?[도이은는을를]?)(?=\s+(?:좀|있었으면|있으면|있어|좋겠))/gu, '그런 $1')
|
||||
|
||||
// 7. 문맥상 명백한 기술 용어 / STT 동음이의어 교정
|
||||
// 'pc' / '피씨' → 'PC'
|
||||
cleaned = cleaned.replace(
|
||||
/\bpc(?=(?:가|는|를|에|에서|로|라고|도|만|와|과|의|\s|$|[,.?!]))/giu,
|
||||
'PC'
|
||||
)
|
||||
cleaned = cleaned.replace(
|
||||
/(?:^|(?<=\s))피씨(?=(?:가|는|를|에|에서|로|라고|도|만|와|과|의|\s|$|[,.?!]))/gu,
|
||||
'PC'
|
||||
)
|
||||
// PC·타이핑·키보드·한글·영어 문맥에서 Whisper가 'PC가'를 '스시가'로 오인식한 경우 복원
|
||||
if (/(?:PC|타이핑|키보드|영어로|한글로|컴퓨터)/u.test(cleaned)) {
|
||||
cleaned = cleaned.replace(/스시(가|는|를|도|로|라고)(?=\s|$|[,.?!])/gu, 'PC$1')
|
||||
}
|
||||
|
||||
// 8. 같은 절 안에서 "~라고 (한글로) 타이핑을 했을 때 ~라고 타이핑하면" 중복 축약
|
||||
cleaned = cleaned.replace(
|
||||
/([가-힣A-Za-z0-9]+라고)\s+([가-힣]+로\s+)?타이핑을?\s+했을\s+때\s+\1\s+타이핑하면/gu,
|
||||
(_m, quoted: string, langMod?: string) => `${quoted} ${langMod ?? ''}타이핑하면`
|
||||
)
|
||||
|
||||
// 다중 공백 정리
|
||||
cleaned = cleaned.replace(/\s{2,}/gu, ' ').trim()
|
||||
|
||||
return cleaned.length > 0 ? cleaned : original
|
||||
}
|
||||
|
|
@ -5,6 +5,7 @@
|
|||
export * from './types'
|
||||
export * from './keybinding'
|
||||
export * from './input-intelligence'
|
||||
export * from './dictation-cleaner'
|
||||
export * from './personal-graph'
|
||||
export * from './errors'
|
||||
export * from './ipc-channels'
|
||||
|
|
|
|||
|
|
@ -1111,9 +1111,31 @@ const LOOSE_JAMO_TWO_LETTER_ENGLISH: Readonly<Record<string, string>> = {
|
|||
ㅕㅌ: 'UX',
|
||||
ㅇㅠ: 'DB',
|
||||
ㅔㅊ: 'PC',
|
||||
ㅖㅊ: 'PC',
|
||||
ㅅㅍ: 'TV',
|
||||
ㅆㅍ: 'TV',
|
||||
ㅑㅇ: 'ID',
|
||||
ㅑㅔ: 'IP',
|
||||
ㅑㅖ: 'IP',
|
||||
ㅐㄴ: 'OS',
|
||||
ㅒㄴ: 'OS',
|
||||
ㅔㄱ: 'PR',
|
||||
ㅖㄱ: 'PR',
|
||||
ㅊㅑ: 'CI',
|
||||
ㅍㅡ: 'VM',
|
||||
ㅔㅡ: 'PM',
|
||||
ㅖㅡ: 'PM',
|
||||
ㅔㅐ: 'PO',
|
||||
ㅖㅐ: 'PO',
|
||||
ㅗㄱ: 'HR',
|
||||
ㅑㄱ: 'IR',
|
||||
ㅇㅡ: 'DM',
|
||||
ㅡㅇ: 'MD',
|
||||
ㅔㅇ: 'PD',
|
||||
ㅖㅇ: 'PD',
|
||||
ㅍㅔ: 'VP',
|
||||
ㅍㅖ: 'VP',
|
||||
ㅠㅡ: 'BM',
|
||||
ㅑㅡ: "I'm"
|
||||
}
|
||||
|
||||
|
|
@ -1697,6 +1719,20 @@ export function detectHangulTypedLatin(
|
|||
}
|
||||
}
|
||||
|
||||
// 2a-2. 한국어 어절/접두 + 한글 자판으로 친 영단어·약어(+조사) 합성어 복원
|
||||
// 예: "내ㅔㅊ" → "내PC", "회사ㅔㅊ에서" → "회사PC에서", "한글로ㅔㅊ라고" → "한글로PC라고", "윈도우ㅐㄴ" → "윈도우OS", "새ㅁㅔㅑ를" → "새API를"
|
||||
const korPrefixAndJamoRest = word.match(/^([가-힣]{1,6})([ㄱ-ㆎ][가-힣ㄱ-ㆎ]*)$/u)
|
||||
if (korPrefixAndJamoRest) {
|
||||
const [, korPrefix, jamoRest] = korPrefixAndJamoRest
|
||||
if (Array.from(korPrefix).every((ch) => isCommonHangulSyllable(ch))) {
|
||||
const restResolved =
|
||||
LOOSE_JAMO_TWO_LETTER_ENGLISH[jamoRest] ?? detectHangulTypedLatin(jamoRest, options)
|
||||
if (restResolved) {
|
||||
return `${korPrefix}${restResolved}`
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const helpers = createMixedWordHelpers(options.vocabulary)
|
||||
const mixed = splitMixedWord(latin, helpers)
|
||||
if (mixed && /^[A-Za-z]{2,}[가-힣]+$/u.test(mixed)) {
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@
|
|||
"settings.postProcess": "Voice Post-Processing",
|
||||
"settings.defaultAction": "Default Post-Processing Command",
|
||||
"settings.action.none": "None (raw transcription)",
|
||||
"settings.action.refine": "Refine (grammar + fluency)",
|
||||
"settings.action.refine": "Refine (remove fillers & repeats, keep tone)",
|
||||
"settings.action.translate": "Translate",
|
||||
"settings.action.summarize": "Summarize",
|
||||
"settings.action.grammar": "Grammar Correction",
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@
|
|||
"settings.postProcess": "음성 후처리",
|
||||
"settings.defaultAction": "기본 후처리 명령어",
|
||||
"settings.action.none": "없음 (원본 텍스트 그대로)",
|
||||
"settings.action.refine": "다듬기 (문법+자연스러움)",
|
||||
"settings.action.refine": "다듬기 (추임새·중복·말바꾸기 정리, 말투 유지)",
|
||||
"settings.action.translate": "번역",
|
||||
"settings.action.summarize": "요약",
|
||||
"settings.action.grammar": "문법 교정",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue