2단계 고도화 선행 작업: 군집화·요약·평가환경·데이터 스펙 (데이터 수령 전)
컴북스 데이터 수령 전 가능한 작업을 선행 구현. 데이터 도착 즉시 학습·검증에 착수할 수 있도록 알고리즘·평가 하니스·문서를 준비. 알고리즘/파이프라인: - engine/clustering.py: 군집화 기반 부분 표절(요소 교체) 판별, detect 응답에 partial_signal 필드 노출 (계획서 2단계 표절검출 고도화) - engine/summarizer.py + POST /v1/summary: TextRank 추출적 요약 + 통합(LLM) 골격 (과제2 ② 스토리 요약/분석) - engine/preference.py + scripts/build_preference_dataset.py: Human Feedback 선호학습(DPO) 데이터 파이프라인 골격 평가 하니스 (정답셋 도착 즉시 측정): - engine/rouge.py + scripts/eval_rouge.py: 요약 ROUGE (지표 No.7) - engine/metadata_eval.py + scripts/eval_metadata_f1.py: 메타 추출 F1 (지표 No.3, KLUE NER 호환) - engine/case_coverage.py + scripts/analyze_case_coverage.py: 39 케이스 갭 분석 → 컴북스 데이터 요청 목록 (정밀도 97% 근거) 문서: - docs/DATA_REQUEST_SPEC.md: 요청 데이터 스펙 + 요약 정답셋/HF 라벨 가이드 - docs/INTEGRATION_INTERFACE.md: 2단계 통합 인터페이스 - docs/SW_COPYRIGHT_REGISTRATION.md: SW 저작권 등록 준비 - docs/PHASE2_PROGRESS.md, docs/CASE_COVERAGE.md 테스트 31 → 67건 전부 통과. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
cfa3d1b7cf
commit
0472ae1f8a
25 files changed
+2053
-2
No files matched your search
@@ -15,11 +15,14 @@ from app.api.schemas import (
|
||||
DetectRequest,
|
||||
DetectResponse,
|
||||
HealthResponse,
|
||||
SummaryRequest,
|
||||
SummaryResponse,
|
||||
TaxonomyResponse,
|
||||
)
|
||||
from app.core.config import get_settings
|
||||
from app.engine.corpus import add_document, delete_document, list_documents
|
||||
from app.engine.detector import PlagiarismDetector
|
||||
from app.engine.summarizer import get_summarizer
|
||||
from app.jobs.store import JobStore
|
||||
|
||||
router = APIRouter(prefix="/v1")
|
||||
@@ -83,6 +86,35 @@ async def detect(req: DetectRequest, request: Request) -> DetectResponse:
|
||||
return _detector(request).detect_request(req)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/summary",
|
||||
response_model=SummaryResponse,
|
||||
tags=["summary"],
|
||||
)
|
||||
async def summarize(req: SummaryRequest) -> SummaryResponse:
|
||||
"""스토리 요약/분석 (계획서 과제2 ②). 추출적 요약은 외부 의존 0으로 동작.
|
||||
|
||||
use_abstractive=True 이고 LLM 키가 있으면 통합(hybrid) 요약, 아니면 추출적 요약 반환.
|
||||
"""
|
||||
settings = get_settings()
|
||||
result = get_summarizer(settings).summarize(
|
||||
req.text,
|
||||
ratio=req.ratio,
|
||||
max_sentences=req.max_sentences,
|
||||
use_abstractive=req.use_abstractive,
|
||||
)
|
||||
return SummaryResponse(
|
||||
extractive=result.extractive,
|
||||
abstractive=result.abstractive,
|
||||
final=result.final,
|
||||
mode=result.mode,
|
||||
selected_indices=result.selected_indices,
|
||||
num_sentences_in=result.num_sentences_in,
|
||||
num_sentences_out=result.num_sentences_out,
|
||||
engine_version=settings.engine_version,
|
||||
)
|
||||
|
||||
|
||||
@router.post(
|
||||
"/plagiarism/batch",
|
||||
response_model=BatchCreatedResponse,
|
||||
|
||||
Reference in new issue
Block a user