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
|
|
@ -7,6 +7,8 @@ import {
|
|||
buildTranscriptGlossary,
|
||||
correctLearnedTerms,
|
||||
sanitizeGlossaryLine,
|
||||
restoreProtectedQualifiers,
|
||||
stripInventedMarkers,
|
||||
} from '../src/transcript-correction'
|
||||
|
||||
/** 재현 가능한 난수 (테스트 실패를 그대로 다시 돌릴 수 있게). */
|
||||
|
|
@ -56,6 +58,42 @@ describe('sanitizeGlossaryLine', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('restoreProtectedQualifiers', () => {
|
||||
it('모델이 지운 한정 부사를 원문 근거로 되돌린다', () => {
|
||||
expect(restoreProtectedQualifiers('사실 거의 근간이라고 봅니다', '사실 근간이라고 봅니다')).toBe(
|
||||
'사실 거의 근간이라고 봅니다',
|
||||
)
|
||||
})
|
||||
|
||||
it('이미 있는 부사는 건드리지 않고, 근거 어절이 없으면 아무 것도 하지 않는다', () => {
|
||||
expect(restoreProtectedQualifiers('거의 근간', '거의 근간')).toBe('거의 근간')
|
||||
expect(restoreProtectedQualifiers('거의 근간', '다른 문장입니다')).toBe('다른 문장입니다')
|
||||
})
|
||||
|
||||
it('원문에 없던 부사를 새로 넣지는 않는다', () => {
|
||||
expect(restoreProtectedQualifiers('근간이라고 봅니다', '근간이라고 봅니다')).toBe('근간이라고 봅니다')
|
||||
})
|
||||
})
|
||||
describe('stripInventedMarkers', () => {
|
||||
it('원문에 시각이 없으면 모델이 붙인 시각 머리를 지운다', () => {
|
||||
expect(stripInventedMarkers('안녕하세요', '[00:00] 안녕하세요')).toBe('안녕하세요')
|
||||
})
|
||||
|
||||
it('원문에 있던 시각은 유지한다', () => {
|
||||
expect(stripInventedMarkers('[00:01] 안녕하세요', '[00:01] 안녕하세요')).toBe('[00:01] 안녕하세요')
|
||||
})
|
||||
|
||||
it('원문에 없던 화자 표기를 지우고 있던 표기는 남긴다', () => {
|
||||
expect(stripInventedMarkers('[화자 1] 안녕하세요', '[화자 1] 안녕하세요 [화자 2] 반갑습니다')).toBe(
|
||||
'[화자 1] 안녕하세요 반갑습니다',
|
||||
)
|
||||
expect(stripInventedMarkers('안녕하세요', '[화자 1] 안녕하세요')).toBe('안녕하세요')
|
||||
})
|
||||
|
||||
it('빈 출력은 그대로 돌려준다', () => {
|
||||
expect(stripInventedMarkers('안녕하세요', '')).toBe('')
|
||||
})
|
||||
})
|
||||
describe('프롬프트 주입 방어', () => {
|
||||
it('사전 단어에 들어간 줄바꿈이 가짜 지시 줄을 만들지 않는다', () => {
|
||||
const glossary = buildTranscriptGlossary({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue