feat(input): upgrade graph personalization, english morphology detection, and atomic SendInput replacement
This commit is contained in:
parent
52eef21bab
commit
cd4a452148
21 changed files with 1098 additions and 110 deletions
|
|
@ -4,12 +4,16 @@
|
|||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
SHARES_TERMS_MIN_SIMILARITY,
|
||||
buildQueryTerms,
|
||||
buildSequenceEdges,
|
||||
continuationsFrom,
|
||||
extractTerms,
|
||||
jaccard,
|
||||
rankRelated,
|
||||
splitSentences
|
||||
rankTwoHopGraphTargets,
|
||||
scoreCandidatePersonalization,
|
||||
splitSentences,
|
||||
stemContinuationsFrom
|
||||
} from '../src/personal-graph'
|
||||
|
||||
describe('extractTerms', () => {
|
||||
|
|
@ -136,4 +140,50 @@ describe('rankRelated', () => {
|
|||
expect(SHARES_TERMS_MIN_SIMILARITY).toBeGreaterThan(0)
|
||||
expect(SHARES_TERMS_MIN_SIMILARITY).toBeLessThan(1)
|
||||
})
|
||||
})
|
||||
|
||||
describe('stemContinuationsFrom · 2-hop 그래프 · 개인화 후보 재정렬', () => {
|
||||
it('조사가 달라도 어간 열이 일치하면 그 뒤의 이어쓰기를 추출한다', () => {
|
||||
const out = stemContinuationsFrom(
|
||||
['회의록 정리해서 내일 오전까지 공유드리겠습니다'],
|
||||
'이번 주간 회의록을 정리해서'
|
||||
)
|
||||
expect(out).toEqual(['내일 오전까지 공유드리겠습니다'])
|
||||
})
|
||||
|
||||
it('2-hop 경로(shares_terms -> follows)로 유사 문장 뒤에 실제로 썼던 후속 문장을 찾는다', () => {
|
||||
const queryTerms = buildQueryTerms([{ text: '금요일 배포 준비 끝났습니다', weight: 2 }])
|
||||
const targets = rankTwoHopGraphTargets({
|
||||
firstHopEdges: [
|
||||
{
|
||||
from: '금요일 배포 준비 완료했습니다',
|
||||
to: '스테이징 배포 점검 끝났습니다',
|
||||
kind: 'shares_terms',
|
||||
weight: 2
|
||||
}
|
||||
],
|
||||
secondHopFollowEdges: [
|
||||
{
|
||||
from: '스테이징 배포 점검 끝났습니다',
|
||||
to: '모니터링 대시보드 링크 공유드립니다',
|
||||
kind: 'follows',
|
||||
weight: 3
|
||||
}
|
||||
],
|
||||
queryTerms
|
||||
})
|
||||
expect(targets).toEqual(['모니터링 대시보드 링크 공유드립니다'])
|
||||
})
|
||||
|
||||
it('개인 그래프 힌트 및 어투와 일치하는 후보에 더 높은 개인화 점수를 준다', () => {
|
||||
const context = {
|
||||
prefix: '오늘 배포 일정 공유드립니다. ',
|
||||
followUpHints: ['모니터링 대시보드 확인 부탁드립니다'],
|
||||
relatedHints: ['릴리즈 노트 정리해서 올렸습니다']
|
||||
}
|
||||
const matchedScore = scoreCandidatePersonalization('모니터링 대시보드 확인 부탁드립니다.', context)
|
||||
const mismatchedRegisterScore = scoreCandidatePersonalization('그냥 빨리 해봐.', context)
|
||||
expect(matchedScore).toBeGreaterThan(4)
|
||||
expect(matchedScore).toBeGreaterThan(mismatchedRegisterScore)
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue