feat(discovery): AEO/GEO 분리 채점 기준표 v2.0 초안 + 리포트 패널

- src/data/aeoGeoRubricV2.ts: AEO 답변 준비도 8항목·GEO 출처 준비도 8항목(각 100), 게이트 2종(크롤러 접근·본문 렌더링 → 상한 40), 부가 지표 11개
- v1.0 36항목을 v2 항목에 1:1 매핑(중복 0·미매핑 0, 스크립트 검사). 항목 점수 = v1 실측 레벨 가중 평균, 사람 판정(v2Results) 우선, 미검증은 분모 제외
- src/lib/discoveryScoreV2.ts 집계, src/components/discovery/AeoGeoV2Panel.tsx 리포트 패널(헤더 아래)
- 뷰성형외과 재채점: v1 54/C → AEO 42/C · GEO 56/C (사람 판정 4개는 수집기 원문 근거 초안). 태하: 게이트 G1(A2) 실패로 40 상한
- docs/AEO_GEO_RUBRIC_v2.md는 scripts/gen_rubric_v2_doc.ts로 코드에서 생성
- tsconfig exclude에 supporters·templates·evidence 추가 (Astro 하위 프로젝트가 루트 tsc에 잡히던 문제)

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Haewon KamandClaude Fable 5.1 committed 2026-09-07 15:12:35 +09:00
1 parent e52331a239
commit c02de9ea51
9 files changed
+769 -1

No files matched your search

+73
View File
@@ -0,0 +1,73 @@
/**
* v2.0 AEO / GEO 분리 집계
*
* - 항목 pct = 사람 판정(v2Results)이 있으면 level/3, 없으면 파생 신호(v1.0 결과)의 가중 평균(level/3)
* - 파생 신호가 전부 미검증이고 사람 판정도 없으면 미검증 → 분모 제외
* - 축 점수 = Σ(weight × pct) / Σ(검증 항목 weight) × 100, 게이트 실패 시 cap 이하로 제한
*/
import type {
AxisScoreV2,
CriterionLevel,
CriterionResult,
DiscoveryResult,
GateResultV2,
ItemScoreV2,
OverallScoreV2,
RubricAxisV2,
RubricGateV2,
RubricItemV2,
RubricV2,
} from '../types/discovery';
import { gradeFromScore } from './discoveryScore';
const round1 = (n: number) => Math.round(n * 10) / 10;
function scoreItem(item: RubricItemV2, byId: Map<string, CriterionResult>, judged: Map<string, CriterionResult>): ItemScoreV2 {
const j = judged.get(item.id);
if (j && j.level !== 'unverified') {
return { item, pct: j.level / 3, earned: round1((item.weight * j.level) / 3), basis: 'judged', signals: [], evidence: j.evidence };
}
const signals = item.derivedFrom.map((d) => ({ criterionId: d.criterionId, level: byId.get(d.criterionId)?.level ?? ('unverified' as const), weight: d.weight }));
const verified = signals.filter((s) => s.level !== 'unverified');
if (!verified.length) return { item, pct: null, earned: 0, basis: 'unverified', signals, evidence: j?.evidence };
const wsum = verified.reduce((s, x) => s + x.weight, 0);
const pct = verified.reduce((s, x) => s + (x.weight * (x.level as CriterionLevel)) / 3, 0) / wsum;
return { item, pct, earned: round1(item.weight * pct), basis: 'derived', signals, evidence: j?.evidence };
}
function evalGate(gate: RubricGateV2, byId: Map<string, CriterionResult>): GateResultV2 {
const failedBy = gate.criterionIds.filter((id) => {
const r = byId.get(id);
return r && r.level !== 'unverified' && r.level <= gate.failLevel;
});
return { gate, passed: failedBy.length === 0, failedBy };
}
function scoreAxis(axis: RubricAxisV2, rubric: RubricV2, byId: Map<string, CriterionResult>, judged: Map<string, CriterionResult>, gates: GateResultV2[]): AxisScoreV2 {
const items = rubric.items.filter((i) => i.axis === axis.id).map((i) => scoreItem(i, byId, judged));
const verified = items.filter((i) => i.pct !== null);
const possible = verified.reduce((s, i) => s + i.item.weight, 0);
const earned = verified.reduce((s, i) => s + i.earned, 0);
const rawScore = possible === 0 ? 0 : Math.round((earned / possible) * 100);
const cappedBy = gates.filter((g) => !g.passed && g.gate.axes.includes(axis.id));
const cap = cappedBy.length ? Math.min(...cappedBy.map((g) => g.gate.cap)) : 100;
const score = Math.min(rawScore, cap);
return { axis, score, rawScore, earned: round1(earned), possible, grade: gradeFromScore(score), items, verifiedCount: verified.length, cappedBy };
}
export function scoreDiscoveryV2(rubric: RubricV2, result: DiscoveryResult): OverallScoreV2 {
const byId = new Map(result.results.map((r) => [r.criterionId, r]));
const judged = new Map((result.v2Results ?? []).map((r) => [r.criterionId, r]));
const gates = rubric.gates.map((g) => evalGate(g, byId));
const [aeoAxis, geoAxis] = [rubric.axes.find((a) => a.id === 'aeo')!, rubric.axes.find((a) => a.id === 'geo')!];
return { aeo: scoreAxis(aeoAxis, rubric, byId, judged, gates), geo: scoreAxis(geoAxis, rubric, byId, judged, gates), gates };
}
/** v1.0 항목이 v2.0 어디에 쓰이는지 (매핑표·중복 검사용) */
export function v1Usage(rubric: RubricV2): Map<string, string[]> {
const m = new Map<string, string[]>();
for (const it of rubric.items) for (const d of it.derivedFrom) m.set(d.criterionId, [...(m.get(d.criterionId) ?? []), it.id]);
for (const g of rubric.gates) for (const id of g.criterionIds) m.set(id, [...(m.get(id) ?? []), g.id]);
for (const a of rubric.auxiliary) m.set(a.criterionId, [...(m.get(a.criterionId) ?? []), `aux:${a.group}`]);
return m;
}