1111
03/04/2026
"""
레이더 차트 + 평가표 생성 코드
실행 방법
1. python radar_report.py 실행
2. radar_chart.png 이미지 생성
3. 콘솔에 평가표 출력
필요 라이브러리
pip install matplotlib numpy pandas
"""
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
# -------------------------------
# 1. 평가 항목 정의
# -------------------------------
labels = [
"텍스트/화학식/특수기호",
"수치 무결성",
"환각 통제",
"표 데이터 정합성",
"문맥 연결",
"차트 데이터 추출",
"이미지 캡션",
"노이즈 제거",
"JSON/Markdown",
"메타데이터 추출"
]
# -------------------------------
# 2. 점수 데이터 입력
# -------------------------------
# 내부 정성 평가 (파란색)
internal_scores = [
9.2,
9.8,
8.8,
7.3,
8.7,
9.0,
7.4,
9.4,
9.6,
10
]
# 개발 현장 평가 (초록색)
field_scores = [
8.9,
9.5,
8.5,
7.0,
8.2,
8.8,
7.1,
9.0,
9.2,
9.5
]
# -------------------------------
# 3. 레이더 차트 생성
# -------------------------------
# 항목 개수
N = len(labels)
# 각도 계산 (레이더 차트용)
angles = np.linspace(0, 2 * np.pi, N, endpoint=False)
# 차트를 닫기 위해 첫 값 추가
angles = np.concatenate((angles, [angles[0]]))
internal = np.concatenate((internal_scores, [internal_scores[0]]))
field = np.concatenate((field_scores, [field_scores[0]]))
# -------------------------------
# 4. matplotlib 레이더 차트 생성
# -------------------------------
fig, ax = plt.subplots(
figsize=(7,7),
subplot_kw=dict(polar=True) # polar=True → 레이더 차트
)
# 내부 정성 평가 (파란색)
ax.plot(
angles,
internal,
linewidth=2,
label="내부 정성 평가"
)
ax.fill(
angles,
internal,
alpha=0.15
)
# 개발 현장 평가 (초록색)
ax.plot(
angles,
field,
linewidth=2,
label="개발 현장 평가"
)
ax.fill(
angles,
field,
alpha=0.15
)
# -------------------------------
# 5. 축 설정
# -------------------------------
# 각 항목 이름 표시
ax.set_xticks(angles[:-1])
ax.set_xticklabels(labels)
# 점수 범위
ax.set_ylim(0, 10)
# 범례
ax.legend(loc="upper right")
# 제목
plt.title("항목별 품질 평가 (10점 만점)", size=14)
# -------------------------------
# 6. 이미지 저장
# -------------------------------
plt.savefig(
"radar_chart.png",
dpi=300,
bbox_inches="tight"
)
print("레이더 차트 이미지 저장 완료 → radar_chart.png")
plt.show()
# -------------------------------
# 7. 평가표 생성 (pandas)
# -------------------------------
data = {
"항목": labels,
"내부 정성 평가": internal_scores,
"개발 현장 평가": field_scores
}
df = pd.DataFrame(data)
# 평균 계산
internal_avg = np.mean(internal_scores)
field_avg = np.mean(field_scores)
# -------------------------------
# 8. 결과 출력
# -------------------------------
print("\n===== 평가 결과 표 =====\n")
print(df)
print("\n===== 평균 점수 =====\n")
print(f"내부 정성 평가 평균 : {internal_avg:.2f}")
print(f"개발 현장 평가 평균 : {field_avg:.2f}")
# -------------------------------
# 9. CSV 파일 저장 (보고서용)
# -------------------------------
df.to_csv("evaluation_table.csv", index=False)
print("\n평가표 CSV 저장 완료 → evaluation_table.csv")
report/
├ radar_chart.png
├ evaluation_table.csv
└ quality_report.html ← 실제 보고서
"""
AI Parser 품질 평가 자동 보고서 생성 스크립트
실행방법
python report_generator.py
생성 결과
report/
├ radar_chart.png
├ evaluation_table.csv
└ quality_report.html
필요 라이브러리
pip install matplotlib numpy pandas
"""
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# -------------------------------------------------
# 1. 결과 저장 폴더 생성
# -------------------------------------------------
os.makedirs("report", exist_ok=True)
# -------------------------------------------------
# 2. 평가 항목 정의
# -------------------------------------------------
labels = [
"텍스트/화학식/특수기호",
"수치 무결성",
"환각 통제",
"표 데이터 정합성",
"문맥 연결",
"차트 데이터 추출",
"이미지 캡션",
"노이즈 제거",
"JSON/Markdown",
"메타데이터 추출"
]
# -------------------------------------------------
# 3. 점수 데이터 입력
# -------------------------------------------------
internal_scores = [
9.2,
9.8,
8.8,
7.3,
8.7,
9.0,
7.4,
9.4,
9.6,
10
]
field_scores = [
8.9,
9.5,
8.5,
7.0,
8.2,
8.8,
7.1,
9.0,
9.2,
9.5
]
# -------------------------------------------------
# 4. 레이더 차트 생성
# -------------------------------------------------
N = len(labels)
angles = np.linspace(0, 2*np.pi, N, endpoint=False)
angles = np.concatenate((angles, [angles[0]]))
internal = np.concatenate((internal_scores, [internal_scores[0]]))
field = np.concatenate((field_scores, [field_scores[0]]))
fig, ax = plt.subplots(
figsize=(7,7),
subplot_kw=dict(polar=True)
)
# 내부정성평가 (파란색)
ax.plot(
angles,
internal,
linewidth=2,
color="blue",
label="내부 정성 평가"
)
ax.fill(
angles,
internal,
color="blue",
alpha=0.15
)
# 개발현장평가 (초록색)
ax.plot(
angles,
field,
linewidth=2,
color="green",
label="개발 현장 평가"
)
ax.fill(
angles,
field,
color="green",
alpha=0.15
)
ax.set_xticks(angles[:-1])
ax.set_xticklabels(labels)
ax.set_ylim(0,10)
ax.legend()
plt.title("항목별 품질 평가 (10점 만점)")
plt.savefig(
"report/radar_chart.png",
dpi=300,
bbox_inches="tight"
)
plt.close()
# -------------------------------------------------
# 5. 평가표 생성
# -------------------------------------------------
df = pd.DataFrame({
"항목": labels,
"내부 정성 평가": internal_scores,
"개발 현장 평가": field_scores
})
df.to_csv("report/evaluation_table.csv", index=False)
# -------------------------------------------------
# 6. 평균 계산
# -------------------------------------------------
internal_avg = np.mean(internal_scores)
field_avg = np.mean(field_scores)
# -------------------------------------------------
# 7. HTML 보고서 생성
# -------------------------------------------------
html = f"""
<html>
<head>
<meta charset="utf-8">
<title>품질 평가 보고서</title>
<style>
body {{
font-family: Arial;
margin:40px;
}}
h1 {{
color:#222;
}}
table {{
border-collapse: collapse;
width:100%;
}}
th, td {{
border:1px solid #ddd;
padding:10px;
text-align:center;
}}
th {{
background:#f2f2f2;
}}
.section {{
margin-top:40px;
}}
</style>
</head>
<body>
<h1>AI Parser 품질 평가 보고서</h1>
<div class="section">
<h2>레이더 차트</h2>
<img src="radar_chart.png" width="600">
</div>
<div class="section">
<h2>평가 점수 표</h2>
{df.to_html(index=False)}
</div>
<div class="section">
<h2>평균 점수</h2>
<p><b>내부 정성 평가 평균 :</b> {internal_avg:.2f}</p>
<p><b>개발 현장 평가 평균 :</b> {field_avg:.2f}</p>
</div>
</body>
</html>
"""
with open("report/quality_report.html", "w", encoding="utf-8") as f:
f.write(html)
# -------------------------------------------------
# 8. 완료 메시지
# -------------------------------------------------
print("\n보고서 생성 완료\n")
print("생성 파일")
print("report/radar_chart.png")
print("report/evaluation_table.csv")
print("report/quality_report.html")
print("\nquality_report.html 열면 전체 보고서 확인 가능\n")
quality_report.html
[레이더 차트]
[평가표]
[평균 점수]