feat(scoring): implemented semantic context padding and optimized excerpting v2.76.0

This commit is contained in:
g1nation
2026-05-05 11:30:29 +09:00
parent fc7cc16e88
commit 18021bd19d
4 changed files with 28 additions and 5 deletions
+15
View File
@@ -94,6 +94,21 @@ describe('Scoring Engine Unit Tests (v2.72.0)', () => {
expect(duration).toBeLessThan(100); // Tokenizer should be efficient even for long text
});
test('Contextual Completeness: should include adjacent sentences for semantic padding', () => {
const content = `
도입부 문장입니다.
핵심 키워드 성능 최적화가 포함된 문장입니다.
마무리 문장입니다.
`;
const query = ['성능', '최적화'];
const excerpt = extractBestExcerpt(content, query, 200);
// Should include introduction and conclusion due to padding
expect(excerpt).toContain('도입부 문장');
expect(excerpt).toContain('핵심 키워드');
expect(excerpt).toContain('마무리 문장');
});
test('Performance Benchmark: should process 100 documents within threshold', () => {
const query = tokenize('performance optimization');
const largeDocs = Array.from({ length: 100 }, (_, i) => ({