차트제목 오탈자 채점결과 적용

This commit is contained in:
2025-05-07 16:18:17 +09:00
parent 2690fa1f4a
commit 2e99590efe
5 changed files with 19 additions and 13 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -363,21 +363,27 @@ class XMLScorer:
user_answer_root = user_answer_tree.getroot() user_answer_root = user_answer_tree.getroot()
correct_answer_tree = ET.parse(correct_answer_file) correct_answer_tree = ET.parse(correct_answer_file)
correct_answer_root = correct_answer_tree.getroot() correct_answer_root = correct_answer_tree.getroot()
chart_xml_tree = ET.fromstring(chart_xml)
# xpath로 바이너리 부분추출 # xpath로 바이너리 부분추출
user_input_text = user_answer_root.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]') user_input_text = user_answer_root.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]')
user_table_text = user_answer_root.xpath('//TABLE//CHAR//text()') user_table_text = user_answer_root.xpath('//TABLE//CHAR//text()')
user_input_text += user_table_text user_input_text += user_table_text
# 차트 제목 추출
user_chart_title = chart_xml_tree.xpath('/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t', namespaces={'c': 'http://schemas.openxmlformats.org/drawingml/2006/chart', 'a': 'http://schemas.openxmlformats.org/drawingml/2006/main'})
user_input_text.append(user_chart_title[0].text)
correct_input_text = correct_answer_root.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]') correct_input_text = correct_answer_root.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]')
correct_table_text = correct_answer_root.xpath('//TABLE//CHAR//text()') correct_table_text = correct_answer_root.xpath('//TABLE//CHAR//text()')
correct_input_text += correct_table_text correct_input_text += correct_table_text
# 차트 XML에서 제목 추출
if chart_xml is not None:
chart_xml_tree = ET.fromstring(chart_xml)
# 차트 제목 추출
user_chart_title = chart_xml_tree.xpath('/c:chartSpace/c:chart/c:title/c:tx/c:rich/a:p/a:r/a:t', namespaces={'c': 'http://schemas.openxmlformats.org/drawingml/2006/chart', 'a': 'http://schemas.openxmlformats.org/drawingml/2006/main'})
# 차트 제목이 존재하는 경우
if user_chart_title:
user_input_text.append(user_chart_title[0].text)
# 차트 제목 정답 텍스트 추출 # 차트 제목 정답 텍스트 추출
correct_chart_title = self.scoring_criteria["2"]["50"]["searchValue"] correct_chart_title = self.scoring_criteria["2"]["50"]["searchValue"]
correct_input_text.append(correct_chart_title) correct_input_text.append(correct_chart_title)
@@ -609,11 +615,11 @@ def main():
# 250429기준 없는 시험 형식(A,B,C..)은 주석처리 하지 않으면 오류 발생 # 250429기준 없는 시험 형식(A,B,C..)은 주석처리 하지 않으면 오류 발생
exam_types = [ exam_types = [
'A', 'A',
# 'B', 'B',
# 'C', 'C',
] ]
# test_mode = False test_mode = False
test_mode = True # test_mode = True
output_excel_paths = [] output_excel_paths = []
for exam_type in exam_types: for exam_type in exam_types: