fix(meeting): keep polish from inventing markers or dropping qualifiers
The local model follows the polish instructions only most of the time: in repeated runs it added a [00:00] or [화자 1] marker that was never in the audio, and it turned "사실 거의 근간" into "사실 근간". Both change what the meeting record says, so they are now enforced in code instead of hoped for in the prompt: markers absent from the original chunk are stripped, and meaning qualifiers the speaker said are restored from that chunk. The instructions themselves were re-measured on the model: a fixed removal list, an explicit qualifier example and a marker ban keep the filler cleanup without touching ordinary words, and the same wording is used by the app, the tests and the probe. Unknown-word repair still depends on the model.
This commit is contained in:
parent
bcd0cf4f23
commit
3aa68f466c
8 changed files with 167 additions and 5 deletions
|
|
@ -59,6 +59,7 @@ import { markdownToDocx } from '@d3ro/core/utils/markdown-to-docx'
|
|||
import { getFileTranscriptionService } from './FileTranscriptionService'
|
||||
import { getTranscriptGlossaryService } from './TranscriptGlossaryService'
|
||||
import { buildPolishTranscriptPrompt } from './meeting/polish-prompt'
|
||||
import { restoreProtectedQualifiers, stripInventedMarkers } from '@d3ro/core/transcript-correction'
|
||||
import { buildImportedMeetingTranscript } from './meeting/imported-recording'
|
||||
import type {
|
||||
MeetingModeState,
|
||||
|
|
@ -1486,7 +1487,9 @@ class MeetingModeService extends EventEmitter {
|
|||
temperature: 0.3,
|
||||
maxTokens: REWRITE_CHUNK_MAX_TOKENS,
|
||||
})
|
||||
const text = carry ? stripEchoedContext(result.text, previousTail) : result.text.trim()
|
||||
const rawText = carry ? stripEchoedContext(result.text, previousTail) : result.text.trim()
|
||||
// 모델이 원문에 없던 시각·화자 표기를 붙였으면 지우고, 지운 한정 부사(거의 등)는 되돌린다.
|
||||
const text = restoreProtectedQualifiers(chunk, stripInventedMarkers(chunk, rawText))
|
||||
if (looksTruncatedRewrite(chunk, text)) {
|
||||
throw new D3ROError(
|
||||
failureCode,
|
||||
|
|
|
|||
|
|
@ -4,6 +4,10 @@
|
|||
// 사용자가 학습시킨 용어로 「잘못 들은 단어」를 반드시 고치게 하되, 근거 없는 일반 단어 교체는 금지한다.
|
||||
// 한글 어절을 1자모 거리로 기계적으로 바꾸면 정상 문장이 망가지는 것을 실측했으므로(MTG-14),
|
||||
// 단어 교체 판단은 문맥을 보는 모델에게 맡기고 근거(용어·표현 목록)를 함께 준다.
|
||||
//
|
||||
// 아래 문장과 순서는 실제 로컬 모델(gemma4:e4b) A/B로 고른 값이다. 순서·표현을 바꾸면 준수도가 달라진다.
|
||||
// 실측(3회): 학습 용어 오인식 복원 3/3, 의미 한정 부사(거의) 보존 3/3, 군더더기 잔존 0,
|
||||
// 원문에 없는 화자·시각 표기 생성 0, 용어 없는 자연 문장은 단어 교체 0.
|
||||
|
||||
/** 교열 규칙 본문 — 글로서리 블록과 분리해 테스트·프로브가 같은 문장을 쓴다. */
|
||||
export const POLISH_TRANSCRIPT_RULES = [
|
||||
|
|
@ -17,6 +21,13 @@ export const POLISH_TRANSCRIPT_RULES = [
|
|||
'- 확실하지 않으면 원문을 그대로 두세요.',
|
||||
'- 화자의 말투(반말/존댓말)와 의미·내용은 바꾸지 마세요. 타임스탬프 [MM:SS]와 화자 표기([화자 N] 등)는 그대로 유지하세요.',
|
||||
'- [사용자가 실제로 쓰는 표현]은 말투·용어 참고용입니다. 그 문장을 그대로 옮겨 쓰지 마세요.',
|
||||
'- 원문에 없는 화자 표기([화자 N], [SPEAKER_01] 등)나 타임스탬프를 새로 붙이지 마세요. 원문에 있는 것만 그대로 유지하세요.',
|
||||
'- 필러를 빼는 것 말고는 단어를 다른 단어로 바꾸지 마세요. 단, 위의 학습 용어·문장이 성립하지 않는 오인식은 고칩니다.',
|
||||
'- "거의", "대부분", "아직" 같은 의미를 한정하는 말은 빼지 마세요.',
|
||||
'- 군더더기로 쓰인 "이제", "그", "약간"도 제거 대상입니다. 시간을 뜻하는 "이제"는 남기세요.',
|
||||
'- 조사 없이 쉼표로 끊긴 말은 자연스러운 한 문장으로 이어 붙이세요.',
|
||||
'- 지울 수 있는 것은 다음뿐입니다: 음, 어, 아, 그, 저, 뭐, 약간, 군더더기 이제, 말하다 멈춘 자기수정("A 아니 A가 아니라 B" → "B"), 같은 말 반복. 이 목록에 없는 단어는 절대 빼거나 바꾸지 마세요.',
|
||||
'- 예: 원문 "사실 거의 근간이라고" → "사실 근간이라고" 로 줄이면 의미가 달라지므로 틀린 교열입니다. "거의"는 남깁니다.',
|
||||
].join('\n')
|
||||
|
||||
/** 글로서리 블록(`buildGlossaryPromptSection`)을 규칙 뒤에 붙인 최종 시스템 프롬프트. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue