2507회 채점기준표 작성 / [2-46] 문항 "차트 줄/칸전환여부" 로직추가

This commit is contained in:
2025-07-29 18:00:04 +09:00
parent b8b233e50a
commit 65c5f348e4
37 changed files with 2420 additions and 1493 deletions

View File

@@ -1,5 +1,3 @@
import tkinter as tk
from tkinter import filedialog, messagebox
from datetime import datetime
import difflib
import json
@@ -373,7 +371,7 @@ class XMLScorer:
# [1-16] ◈ 행사안내 ◈
# 특수문자와 글자의 속성이 같고 문서 내부에 '행사안내'와 같은 문자가 있을 경우
# 유사도 문제로 의도치 않은 부분의 속성이 채점되는것을 방지하고자
# 유사도 문제로 의도치 않은 다른 부분의 텍스트 속성이 채점되는것을 방지하고자
# 해당 문자를 포함하는 모든 문단의 속성을 판단해
# 정렬값이 정답과 일치하는 경우 정답으로 채점
elif (category or "") == "Align":
@@ -387,7 +385,35 @@ class XMLScorer:
self.evaluate_answer(scoring, user_answer, right_answer, points)
if scoring['points'] > 0:
break
elif (category or "") == "majorGridlines":
# 줄/칸 전환여부 확인
table_col_count = root.xpath("//SECTION[2]//TABLE/@ColCount")
print("🟡테이블 열 개수: ", int(table_col_count[0]) if table_col_count else 0)
chart_ser_count = chart_tree.xpath("count(//c:ser)", namespaces=namespaces) if chart_xpath else 0
print("🟡차트 데이터 개수: ", int(chart_ser_count) if isinstance(chart_ser_count, (int, float)) else 0)
isXYtransposed = False
if table_col_count and chart_ser_count:
if int(chart_ser_count) >= int(table_col_count[0]):
isXYtransposed = True
# 값 축 주눈금선 존재하는지 여부 확인
items = chart_tree.xpath(chart_xpath, namespaces=namespaces) if chart_xpath else []
for item in items:
# item이 존재하면 True, 없으면 False
user_answer = (item is not None) and isXYtransposed
# 정답과 수험자 답안 비교
self.evaluate_answer(scoring, user_answer, right_answer, points)
if scoring['points'] > 0:
break
# 정답이 하나인 경우
# elif (category or "") == "OneAnswer":
elif (category or "") in ["OneAnswer", "ChartOneAnswer"]:
@@ -732,6 +758,7 @@ class XMLScorer:
linespacing = root.xpath(xpath)
user_answer = linespacing[0]
# print("🟡줄간격: ", user_answer)
if user_answer != right_answer:
linespacing_match = False
break
@@ -741,7 +768,7 @@ class XMLScorer:
# 2. 해당 문제의 정답 줄간격 (180% = 28pt / 200% = 30pt )
# 두 경우의 글자 크기가 아니라면 오답처리
firstword = criterion.get('first_word', None)
result = root.xpath(f"//CHARSHAPE[@Id=//TEXT[CHAR[text()='{firstword}']]/@CharShape]/@Height")
result = root.xpath(f"//CHARSHAPE[@Id=//RECTANGLE//TEXT[CHAR[text()='{firstword}']]/@CharShape]/@Height")
firstword_size = result[0] if result else None
if (right_answer == '180' and firstword_size not in ['2600', '2800', None]) or (right_answer == '200' and firstword_size not in ['2600', '3000', None]):
@@ -1244,14 +1271,14 @@ class XMLScorer:
def main():
# 시험회차 및 유형
exam_round = '2506'
exam_round = '2507'
# exam_round = '2506_5'
# 채점하고자 하는 유형은 주석 해제
exam_types = [
# 'A',
# 'B',
'C',
'B',
# 'C',
# 'D',
]