diff --git a/CHANGELOG.md b/CHANGELOG.md index f2f8236..c138cf3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Plugin system for custom pipelines +## [1.16.4] - 2026-11-06 + +> AI correction of transcripts is now grounded in the vocabulary the app learned from typing. + +### Changed +- AI polishing (recorded or pasted transcripts) treats learned vocabulary as the correction source: names, product names and in-house terms the transcript misheard are rewritten to the learned spelling, while ordinary nouns and endings are left alone. The learned term list and the user expressions are given to the model, and dictionary pronunciations plus typed identifiers are fixed deterministically before and after the model runs. +- Dictation output is checked against the learned vocabulary once more after the language model finishes, so a term the model rewrote is restored. + +### Fixed +- Hangul-layout typing artifacts (dkssudgktpdy) no longer appear in the term list, the correction hints, or the style examples handed to the model. + ## [1.16.3] - 2026-11-06 > Supersedes 1.16.2, which could rewrite ordinary Korean words in transcripts. diff --git a/apps/desktop/src/main/services/MeetingModeService.ts b/apps/desktop/src/main/services/MeetingModeService.ts index 9c270b8..7beb165 100644 --- a/apps/desktop/src/main/services/MeetingModeService.ts +++ b/apps/desktop/src/main/services/MeetingModeService.ts @@ -95,6 +95,26 @@ const TRANSCRIPTION_FAILED_MESSAGE = 'Transcription failed during recording' /** 자막 인식 실패를 렌더러에 다시 알리는 최소 간격 */ const CAPTION_FAILURE_NOTICE_INTERVAL_MS = 30_000 +/** + * 전사 AI 교열(다듬기) 지시문. + * + * 사용자가 학습시킨 용어로 「잘못 들은 단어」를 반드시 고치게 하되, 근거 없는 일반 단어 교체는 금지한다. + * 한글 어절을 1자모 거리로 기계적으로 바꾸면 정상 문장이 망가지는 것을 실측했으므로(MTG-14), + * 단어 교체 판단은 문맥을 보는 모델에게 맡기고 근거(용어·표현 목록)를 함께 준다. + */ +const POLISH_TRANSCRIPT_PROMPT = [ + '다음 음성 전사 텍스트를 회의록으로 다듬습니다.', + '', + '## 반드시 지킬 것', + '- 필러(음, 어, 그, 아, 뭐 등)·말 바꾸기(A 아니 A가 아니라 B → B)·불필요한 어절·의미 중복을 제거하세요.', + '- 아래 [사용자 용어]·[사용자가 자주 쓰는 용어]와 같은 이름·제품명·사내 용어가 전사에서 비슷하게 다르게 적혀 있고 문맥상 그것이 확실하면, **반드시 그 표기로 고치세요.**', + '- 이미 맞게 적힌 용어는 그대로 두세요.', + '- 반대로, 근거가 없는 일반 명사·부사·조사·어미는 절대 다른 단어로 바꾸지 마세요. 비슷하게 들린다는 이유만으로 단어를 바꾸면 문장이 망가집니다.', + '- 확실하지 않으면 원문을 그대로 두세요.', + '- 화자의 말투(반말/존댓말)와 의미·내용은 바꾸지 마세요. 타임스탬프 [MM:SS]와 화자 표기([화자 N] 등)는 그대로 유지하세요.', + '- [사용자가 실제로 쓰는 표현]은 말투·용어 참고용입니다. 그 문장을 그대로 옮겨 쓰지 마세요.', +].join('\n') + /** * 회의 기능이 쓰는 LLM 포트 — 백엔드 선택(local/online, 폴백)은 LlmGateway 한 곳이 정한다. * 문서 생성·요약 입력은 이 한도(프록시 메시지 한도) 안으로 맞춘다. @@ -1429,21 +1449,30 @@ class MeetingModeService extends EventEmitter { if (!transcript) throw new D3ROError(ErrorCode.MeetingPolishFailed, '전사 텍스트가 없습니다') const llm = await this._resolveMeetingLlm() - // 사용자가 학습시킨 용어·표현을 교열 지시에 넘긴다 — 예전엔 일반 프롬프트만 받아 - // 고유명사·사내 용어가 매번 다르게 교정됐다. - const glossary = getTranscriptGlossaryService().promptSection() + // 1) 결정적 교정 먼저 — 사전 발음·학습 식별자는 LLM 없이도 확실히 고친다(모델이 놓쳐도 남는다). + const glossaryService = getTranscriptGlossaryService() + const preCorrected = glossaryService.correct(transcript) + if (preCorrected.corrections.length > 0) { + logger.info(`전사 교열: 학습 어휘로 ${preCorrected.corrections.length}건 먼저 교정`) + } + + // 2) 사용자가 학습시킨 용어·표현을 교열 지시에 넘긴다 — 고유명사·사내 용어를 문맥으로 판단해 + // 반드시 학습 표기로 고치되, 근거 없는 일반 단어는 바꾸지 말라고 명시한다. + const glossary = glossaryService.promptSection() const polished = await this._rewriteTranscriptInChunks( llm, - transcript, - '다음 음성 전사 텍스트를 다듬어주세요. 필러 단어(음, 어, 그, 아, 뭐 등), 말 바꾸기(A 아니 A가 아니라 B → B), 불필요한 어절·의미 중복을 제거하고 문장 구조를 자연스럽게 교정하되, 화자의 원래 말투(반말/존댓말)와 의미·내용은 절대 변경하지 마세요. 타임스탬프 형식 [MM:SS]과 화자 표기([화자 N] 등)는 그대로 유지하세요.' + - (glossary ? `\n\n${glossary}` : ''), + preCorrected.text, + POLISH_TRANSCRIPT_PROMPT + (glossary ? `\n\n${glossary}` : ''), ErrorCode.MeetingPolishFailed, ) - this._writeRewrite(sessionId, polished, base, ErrorCode.MeetingPolishFailed) + // 3) 모델이 용어를 다른 표기로 되돌렸을 수 있다 — 정본 표기를 마지막에 다시 강제한다. + const finalText = glossaryService.correct(polished).text + + this._writeRewrite(sessionId, finalText, base, ErrorCode.MeetingPolishFailed) logger.info(`Auto Polish 완료: sessionId=${sessionId}`) - return polished + return finalText } /** diff --git a/apps/desktop/src/main/services/VoiceModeService.ts b/apps/desktop/src/main/services/VoiceModeService.ts index e3c7d91..aa73893 100644 --- a/apps/desktop/src/main/services/VoiceModeService.ts +++ b/apps/desktop/src/main/services/VoiceModeService.ts @@ -1068,8 +1068,9 @@ class VoiceModeService extends EventEmitter { const { getChainService } = await import('./ChainService') const chainResult = await getChainService().execute(route.chainId, userText) if (!this._isCurrent(run)) return - if (this._session) this._session.processedText = chainResult.finalText - await this._completeSession(run, chainResult.finalText) + const learnedChain = getTranscriptGlossaryService().correct(chainResult.finalText).text + if (this._session) this._session.processedText = learnedChain + await this._completeSession(run, learnedChain) } catch (error) { if (!this._isCurrent(run)) return logger.warn(`Chain execution failed: ${describe(error)}`) @@ -1090,11 +1091,14 @@ class VoiceModeService extends EventEmitter { if (!this._isCurrent(run)) return + // 모델이 고유명사·식별자를 다른 표기로 바꿔 놓았을 수 있다 — 학습 표기를 마지막에 다시 강제한다. + const learnedText = getTranscriptGlossaryService().correct(processedText).text + if (this._session) { - this._session.processedText = processedText + this._session.processedText = learnedText } - await this._completeSession(run, processedText) + await this._completeSession(run, learnedText) } catch (error) { if (!this._isCurrent(run)) return this._handleError( diff --git a/apps/desktop/tests/red/meeting-llm.usecase.test.ts b/apps/desktop/tests/red/meeting-llm.usecase.test.ts index d653146..e972084 100644 --- a/apps/desktop/tests/red/meeting-llm.usecase.test.ts +++ b/apps/desktop/tests/red/meeting-llm.usecase.test.ts @@ -4,6 +4,7 @@ import { getMeetingModeService } from '../../src/main/services/MeetingModeServic import { getDatabase } from '../../src/main/db' import { meetingSessions } from '../../src/main/db/schema' import { configSet } from '../../src/main/services/ConfigService' +import { getDictionaryService } from '../../src/main/services/DictionaryService' import { useRedHarness } from './harness' import { FX, USER_TEXT } from './fixtures' @@ -81,6 +82,21 @@ describe('유스케이스: 회의 문서/폴리시가 로컬 LLM 을 탄다', () expect(premiumGenerate).not.toHaveBeenCalled() }) + it('polish 는 모델이 되돌린 사전 표기를 학습 표기로 다시 강제한다', async () => { + configSet('llmBackend', 'local') + getDictionaryService().add({ word: 'D3RO', pronunciation: '디에로' }) + insertSession('meet-polish-dict') + localGenerate.mockClear() + // 모델이 사전 표기를 무시하고 발음 그대로 돌려준 상황 + localGenerate.mockResolvedValueOnce({ text: '[00:01] 디에로 보이스 설정 확인해 주세요', model: 'fx-local-model' }) + + const polished = await getMeetingModeService().polishTranscript('meet-polish-dict') + + expect(polished).toBe('[00:01] D3RO 보이스 설정 확인해 주세요') + const systemPrompt = String(localGenerate.mock.calls.at(-1)?.[1]?.systemPrompt ?? '') + expect(systemPrompt).toContain('[사용자 용어') + expect(systemPrompt).toContain('D3RO') + }) it('없는 세션 polish 는 MeetingSessionNotFound 다', async () => { configSet('llmBackend', 'local') await expect(getMeetingModeService().polishTranscript('missing')).rejects.toMatchObject({ diff --git a/docs/map/10-feature-catalog.md b/docs/map/10-feature-catalog.md index 520eeb6..0b18050 100644 --- a/docs/map/10-feature-catalog.md +++ b/docs/map/10-feature-catalog.md @@ -89,7 +89,7 @@ Status quick-reference: `[x]` done+verified · `[~]` partial/unverified · `[ ]` | MTG-11 | Meeting AI chat over transcript | [x] | [ ] | [ ] | [x] | Desktop `MeetingChatPanel` + `MEETING_CHAT` | | MTG-12 | Content reporting for generated docs | [-] | [ ] | [x] | [x] | `content-report` Edge + generation receipts | | MTG-13 | Existing audio/video import into a meeting | [x] | [ ] | [~] | [x] | **2026-11-01:** Desktop `meetingMode:importRecording` reuses `FileTranscriptionService` without duplicate history, saves canonical timestamped transcript + normalized WAV, then opens existing minutes generation. Mobile `MeetingsScreen` creates the workspace then routes `meetingId` + `importRequest` to the existing durable Record meeting pipeline. **2026-11-02:** installed Windows 1.16.0 passed the actual Electron picker→timestamped transcript→local summary/action-item journey, so desktop is `[x]`. Fold6 `.3` import entry/editor rendered, but authenticated device file-to-minutes E2E remains (`GAP-MTG-03`). [Evidence](../evidence/2026-11-02-verification.md). | -| MTG-14 | Learning-informed transcript correction (user dictionary + typed vocabulary) | [~] | [ ] | [ ] | [ ] | **2026-11-05 (root cause + rebuild of the transcript-correction seam):** the learned corpus was only wired to input suggestions. Meeting/live captions ran STT with a hardcoded `다음은 한국어 대화입니다.` prompt (no dictionary, no learned terms), the refine prompt had no glossary, the refine result updated only `CaptionService`'s own copy (meetings and the renderer kept the raw line), and the persisted `rawTranscript` was a plain join of raw segments. Now: core SSOT `@d3ro/core/transcript-correction` (glossary build, dictionary-variant replacement, learned-identifier correction with a unique-best rule, LLM reference block) + desktop `TranscriptGlossaryService` (dictionary + `personal_phrases`, 15 s cache invalidated on dictionary writes, fail-closed) are wired into `CaptionService` (hint on every recognition, deterministic correction per final line, glossary-aware refine, `segment-updated` event), `MeetingRecordingSession`/`MeetingModeService` (refined lines reach the meeting transcript and renderer via `meetingMode:segmentUpdated`; auto-polish gets the glossary block), `FileTranscriptionService` (per-chunk hint + correction) and `VoiceModeService` (learned-term pass). **2026-11-05 (v1.16.3 correction policy):** the first cut also rewrote ordinary Hangul words by 1-jamo distance. Measured against the real local corpus (users/_local/d3ro.db, 3 stored meeting transcripts) it changed **286 of 3,005 words** (하면 to 라면, 이제 to 이게, 매일 to 메일, 정보 to 정도). Deterministic correction is now limited to dictionary pronunciations and typed Latin identifiers (canonical casing preserved); Korean terms reach recognition through the STT hint and the polish prompt only. Re-measured on the same corpus: **0 of 3,005**. Real-engine check (sidecar large-v3-turbo, Korean TTS fixture containing the user term): baseline 하람로그에 to hinted transcript haramlog에, and a dictionary pronunciation entry still maps 디에로 to D3RO. Hangul-layout typing artifacts (dkssudgktpdy) are dropped from the hint. Tests: core transcript-correction.test.ts (16), desktop transcript-glossary.test.ts (10); live meeting with real jargon still open (GAP-MTG-04). | +| MTG-14 | Learning-informed transcript correction (user dictionary + typed vocabulary) | [~] | [ ] | [ ] | [ ] | **2026-11-05 (root cause + rebuild of the transcript-correction seam):** the learned corpus was only wired to input suggestions. Meeting/live captions ran STT with a hardcoded `다음은 한국어 대화입니다.` prompt (no dictionary, no learned terms), the refine prompt had no glossary, the refine result updated only `CaptionService`'s own copy (meetings and the renderer kept the raw line), and the persisted `rawTranscript` was a plain join of raw segments. Now: core SSOT `@d3ro/core/transcript-correction` (glossary build, dictionary-variant replacement, learned-identifier correction with a unique-best rule, LLM reference block) + desktop `TranscriptGlossaryService` (dictionary + `personal_phrases`, 15 s cache invalidated on dictionary writes, fail-closed) are wired into `CaptionService` (hint on every recognition, deterministic correction per final line, glossary-aware refine, `segment-updated` event), `MeetingRecordingSession`/`MeetingModeService` (refined lines reach the meeting transcript and renderer via `meetingMode:segmentUpdated`; auto-polish gets the glossary block), `FileTranscriptionService` (per-chunk hint + correction) and `VoiceModeService` (learned-term pass). **2026-11-05 (v1.16.3 correction policy):** the first cut also rewrote ordinary Hangul words by 1-jamo distance. Measured against the real local corpus (users/_local/d3ro.db, 3 stored meeting transcripts) it changed **286 of 3,005 words** (하면 to 라면, 이제 to 이게, 매일 to 메일, 정보 to 정도). Deterministic correction is now limited to dictionary pronunciations and typed Latin identifiers (canonical casing preserved); Korean terms reach recognition through the STT hint and the polish prompt only. Re-measured on the same corpus: **0 of 3,005**. Real-engine check (sidecar large-v3-turbo, Korean TTS fixture containing the user term): baseline 하람로그에 to hinted transcript haramlog에, and a dictionary pronunciation entry still maps 디에로 to D3RO. Hangul-layout typing artifacts (dkssudgktpdy) are dropped from the hint. **2026-11-06 (v1.16.4 AI correction grounded in learning):** the polish pass no longer runs as a generic rewrite. Deterministic dictionary/identifier correction runs before and after the model, and the model receives a learned term list plus the user expressions with explicit rules (fix a misheard name/product/in-house term to the learned spelling; never swap ordinary nouns or endings on similarity alone). Re-measured on the real corpus: 0 of 3,005 deterministic changes, and the generated term block now shows canonical identifiers (HaramLog, Android, AI) with Hangul-layout artifacts removed from terms, hints and style examples. Dictation output is re-checked against the learned vocabulary after the LLM finishes. Tests: core transcript-correction.test.ts (17), desktop transcript-glossary.test.ts (10), red meeting-llm usecase (+1); live meeting with real jargon still open (GAP-MTG-04). | --- diff --git a/memory/project_status.md b/memory/project_status.md index a739fb8..1ef846c 100644 --- a/memory/project_status.md +++ b/memory/project_status.md @@ -7,6 +7,7 @@ - 해결: 새 SSOT `packages/core/src/transcript-correction.ts`(글로서리·사전 변형 치환·1자모 학습 어절 교정·LLM 참고 블록) + `TranscriptGlossaryService`(사전+개인 문구 15초 캐시, 사전 변경 시 즉시 무효화, 실패 시 빈 어휘) 를 `CaptionService`(매 인식 힌트·확정 줄 교정·교열 프롬프트·`segment-updated`), `MeetingRecordingSession`/`MeetingModeService`(`meetingMode:segmentUpdated`로 회의 세션·화면 갱신, auto-polish에 용어 블록), `FileTranscriptionService`(조각별 힌트·교정), `VoiceModeService`(학습 어절 패스)에 배선. - 교정 안전 규칙: 사용자가 실제로 쓴 어절은 절대 변경하지 않고, 후보가 동률이면 고치지 않으며, 조사는 그대로 두고 어절만 바꾼다. - 검증: core `transcript-correction.test.ts` 16, 데스크톱 `transcript-glossary.test.ts` 9, 데스크톱 offline 전체(2788)에서 드러난 회귀 2건을 수정해 재통과, workspace typecheck·변경 파일 ESLint·`test:hygiene` GREEN. 실회의 실측은 `GAP-MTG-04`로 남김. +- **1.16.4 (AI 교열을 학습 기반으로):** 회의 전사 AI 다듬기(polish)가 일반 재작성 대신 학습 어휘를 교정 근거로 쓴다. 다듬기 전·후에 결정적 교정(사전 발음·라틴 식별자)을 돌리고, 모델에는 [사용자 용어]·[자주 쓰는 용어]·[사용자 표현]과 함께 「오인식이 문맥상 확실하면 학습 표기로 반드시 고치고, 근거 없는 일반 명사·조사·어미는 건드리지 말라」는 규칙을 넣는다. 받아쓰기 LLM 결과도 학습 표기로 다시 강제한다. 실데이터 프롬프트 블록 확인: HaramLog·Android·AI 대소문자 보존, 한영 자판 산물은 용어·힌트·예시에서 모두 제거, 실제 전사 3,005어절 결정적 변경 0. - **1.16.2 배포 직후 실사용 DB로 직접 검증해 결함 발견 → 1.16.3으로 수정:** `users/_local/d3ro.db`(개인 문구 1,952·이핑 표본 2,522·회의 전사 3건)에 결정적 교정을 돌리니 실제 전사 3,005어절 중 **286개가 잘못 바뀌었다**(하면→라면, 이제→이게, 매일→메일, 정보→정도, 일단→일반). 학습 어휘 대부분이 일반 명사·부사·어미라 1자모 거리로는 오인식과 정상 단어를 구분할 수 없다. 수정: 결정적 교정은 **사전 발음 변형 + 사용자가 친 라틴 식별자**만(대소문자 보존), 한글 용어는 STT 힌트·LLM 교열 참고로만. 같은 코퍼스 재측정 **0/3,005**. 실제 사이드카(`large-v3-turbo`)로 한국어 TTS 픽스처 검증: 힌트 없음 `하람로그에` → 힌트 있음 `haramlog에`, 사전 발음 등록 시 `디에로`→`D3RO`. 한영 자판 오타 산물(`dkssudgktpdy`)은 힌트에서 제외. 교훈: **"학습 데이터를 쓴다"는 기능은 실사용 코퍼스로 오탐을 먼저 재고 나서 켠다.** ## v1.9.0 — 전사 구간·프리셋 프롬프트 동기화 (2026-09-27) diff --git a/packages/core/__tests__/transcript-correction.test.ts b/packages/core/__tests__/transcript-correction.test.ts index 3fed7f3..1365cf1 100644 --- a/packages/core/__tests__/transcript-correction.test.ts +++ b/packages/core/__tests__/transcript-correction.test.ts @@ -152,6 +152,19 @@ describe('LLM 교열 참고 블록', () => { expect(section).toContain('오늘 회의는 세 시에 시작합니다') }) + it('자주 쓰는 용어와 교정 지시를 함께 넣는다', () => { + const glossary = buildTranscriptGlossary({ + dictionary: [{ word: 'D3RO', pronunciation: '디에로' }], + phrases: phrases(['하람로그에 정리해줘', 6], ['안녕하세요', 4], ['dkssudgktpdy', 3]), + }) + + const section = buildGlossaryPromptSection(glossary) + + expect(section).toContain('반드시 아래 표기로 고치세요') + expect(section).toContain('[사용자가 자주 쓰는 용어') + expect(section).toContain('하람로그') + expect(section).not.toContain('dkssudgktpdy') + }) it('STT 힌트는 기존 문맥 뒤에 붙는다', () => { const glossary = buildTranscriptGlossary({ dictionary: [{ word: 'Whisper' }] }) diff --git a/packages/core/src/transcript-correction.ts b/packages/core/src/transcript-correction.ts index 0e06e20..029d964 100644 --- a/packages/core/src/transcript-correction.ts +++ b/packages/core/src/transcript-correction.ts @@ -156,32 +156,34 @@ export function buildTranscriptGlossary(input: { } const examples: string[] = [] + const exampleCandidates: Array<{ text: string; tokens: readonly string[] }> = [] const phraseTokens = new Map() - /** 같은 뜻의 한글 표기가 코퍼스에 있는 영문 토큰(한영 자판 오타 산물) — 힌트·교정에서 뺀다. */ + /** 같은 뜻의 한글 표기가 코퍼스에 있는 영문 토큰(한영 자판 오타 산물) — 힌트·교정·예시에서 뺀다. */ const hangulObserved = new Set() for (const phrase of (input.phrases ?? []).slice(0, limits.phrases)) { const text = phrase.text?.replace(/\s+/gu, ' ').trim() if (!text) continue - if ( - examples.length < limits.refineExamples && - text.length >= 4 && - text.length <= 80 && - !examples.includes(text) - ) { - examples.push(text) - } + const tokens: string[] = [] const weight = Math.max(1, phrase.count) for (const token of tokenizeWords(text)) { const word = token.text if (!isLearnableToken(word)) continue if (/^[가-힣]+$/u.test(word)) hangulObserved.add(word) const key = word.toLowerCase() + tokens.push(key) bump(phraseTokens, key, weight) if (!canonical.has(key)) canonical.set(key, word) } + if ( + exampleCandidates.length < limits.refineExamples * 2 && + text.length >= 4 && + text.length <= 80 + ) { + exampleCandidates.push({ text, tokens }) + } } - // 한영 자판 오타 산물( 같은)은 같은 뜻의 한글 표기가 코퍼스에 있으므로 뺀다. + // 한영 자판 오타 산물(dkssudgktpdy 같은)은 같은 뜻의 한글 표기가 코퍼스에 있으므로 뺀다. // 그대로 두면 STT 힌트가 의미 없는 라틴 문자열로 편향되고, 식별자 교정 후보로도 쓰인다. for (const word of [...phraseTokens.keys()]) { if (!/^[a-z]+$/u.test(word)) continue @@ -192,6 +194,14 @@ export function buildTranscriptGlossary(input: { } } + // 교정 산물이 섞인 문장은 예시로도 쓰지 않는다 — 모델이 그 표기를 따라 쓰게 된다. + for (const candidate of exampleCandidates) { + if (examples.length >= limits.refineExamples) break + if (examples.includes(candidate.text)) continue + if (candidate.tokens.some((token) => /^[a-z]+$/u.test(token) && !phraseTokens.has(token))) continue + examples.push(candidate.text) + } + for (const [word, count] of topEntries(phraseTokens, limits.vocabularyTerms)) { if (count < limits.minLearnedCount) break if (vocabulary.has(word)) continue @@ -425,6 +435,7 @@ export function buildGlossaryPromptSection(glossary: TranscriptGlossary): string const parts: string[] = [] if (glossary.dictionary.length > 0) { parts.push('[사용자 용어 — 이 표기를 그대로 쓰세요]') + parts.push('전사에 이 용어가 비슷하게 다르게 적혀 있으면 반드시 아래 표기로 고치세요. 이미 맞게 적힌 것은 건드리지 마세요.') for (const entry of glossary.dictionary.slice(0, 30)) { parts.push( entry.variants.length > 0 @@ -433,6 +444,18 @@ export function buildGlossaryPromptSection(glossary: TranscriptGlossary): string ) } } + const frequentTerms = [...glossary.vocabulary.entries()] + .filter(([word, count]) => count >= TRANSCRIPT_GLOSSARY_LIMITS.minLearnedCount && word.length >= 2) + .sort((a, b) => (b[1] - a[1] !== 0 ? b[1] - a[1] : a[0].localeCompare(b[0]))) + .slice(0, 20) + .map(([word]) => glossary.canonical.get(word) ?? word) + if (frequentTerms.length > 0) { + parts.push( + '', + '[사용자가 자주 쓰는 용어 — 문맥상 이 단어를 말한 것이 확실하면 이 표기로 쓰세요]', + frequentTerms.join(', '), + ) + } if (glossary.examples.length > 0) { parts.push('', '[사용자가 실제로 쓰는 표현 — 말투·용어만 참고하고 문장을 그대로 베끼지 마세요]') for (const example of glossary.examples.slice(0, TRANSCRIPT_GLOSSARY_LIMITS.refineExamples)) {