한글채점 소스코드 개선버전 추가/수정 진행중

This commit is contained in:
2025-04-23 17:48:46 +09:00
parent d6ef894fc6
commit 102817eb34
8 changed files with 3428 additions and 862 deletions

View File

@@ -160,10 +160,42 @@ class XMLScorer:
search_value = criterion['searchValue'] if 'searchValue' in criterion else None
right_answer = criterion['value'] if 'value' in criterion else None
points = criterion['points'] if 'points' in criterion else None
category = criterion['category']
category = criterion['category'] if 'category' in criterion else None
item = criterion['item']
similar_text = None
# if "pageSetting" in (format or ""):
# results = root.xpath("//PAGEMARGIN")
# matched = False
# for i, user_answer in enumerate(results):
# bottom = int(user_answer.get("Bottom"), 0)
# footer = int(user_answer.get("Footer"), 0)
# gutter = int(user_answer.get("Gutter"), 0)
# header = int(user_answer.get("Header"), 0)
# left = int(user_answer.get("Left"), 0)
# right = int(user_answer.get("Right"), 0)
# top = int(user_answer.get("Top"), 0)
# error_range = 1
# if abs(right_answer['Bottom'] - bottom) <= error_range and \
# abs(right_answer['Footer'] - footer) <= error_range and \
# abs(right_answer['Gutter'] - gutter) <= error_range and \
# abs(right_answer['Header'] - header) <= error_range and \
# abs(right_answer['Left'] - left) <= error_range and \
# abs(right_answer['Right'] - right) <= error_range and \
# abs(right_answer['Top'] - top) <= error_range:
# matched = True
# total_score += points
# partial_score += points
# scoring['points'] = points
# break
# if not matched:
# scoring['points'] = 0
# chart xml 파일에서 채점하는 경우
if "chart_xml" in category:
if search_value is not None:
@@ -207,7 +239,7 @@ class XMLScorer:
if "오타감점" in category:
points = self.get_typo_score()
scoring = {
'section': section_id,
'id': id,
@@ -218,7 +250,7 @@ class XMLScorer:
'points': points,
'deductions': [] # 각 기준별 감점 내역
}
# 점수 차감 조건
# 1. 정답이 실수형으로 반환받은 경우는 채점항목의 부분점수 합산 결과이므로
# 반환받은 값 그대로를 점수로 사용
@@ -531,8 +563,8 @@ def main():
exam_round = '2503'
exam_types = [
'A',
'B',
'C',
# 'B',
# 'C',
]
# test_mode = False
test_mode = True