diff --git a/250507_DIW_2504회_A형_TEST.xlsx b/250507_DIW_2504회_A형_TEST.xlsx deleted file mode 100644 index 1ec42ca..0000000 Binary files a/250507_DIW_2504회_A형_TEST.xlsx and /dev/null differ diff --git a/250507_DIW_2504회_A형_채점결과.xlsx b/250507_DIW_2504회_A형_채점결과.xlsx new file mode 100644 index 0000000..2509e91 Binary files /dev/null and b/250507_DIW_2504회_A형_채점결과.xlsx differ diff --git a/250507_DIW_2504회_B형_채점결과.xlsx b/250507_DIW_2504회_B형_채점결과.xlsx new file mode 100644 index 0000000..cd969ae Binary files /dev/null and b/250507_DIW_2504회_B형_채점결과.xlsx differ diff --git a/250507_DIW_2504회_C형_채점결과.xlsx b/250507_DIW_2504회_C형_채점결과.xlsx new file mode 100644 index 0000000..2236a77 Binary files /dev/null and b/250507_DIW_2504회_C형_채점결과.xlsx differ diff --git a/diwScoring.py b/diwScoring.py index fa6b550..09ee799 100644 --- a/diwScoring.py +++ b/diwScoring.py @@ -363,24 +363,30 @@ class XMLScorer: user_answer_root = user_answer_tree.getroot() correct_answer_tree = ET.parse(correct_answer_file) correct_answer_root = correct_answer_tree.getroot() - chart_xml_tree = ET.fromstring(chart_xml) # xpath로 바이너리 부분추출 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_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_table_text = correct_answer_root.xpath('//TABLE//CHAR//text()') correct_input_text += correct_table_text - # 차트 제목 정답 텍스트 추출 - correct_chart_title = self.scoring_criteria["2"]["50"]["searchValue"] - correct_input_text.append(correct_chart_title) + # 차트 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_input_text.append(correct_chart_title) # 각 요소에서 공백 제거 user_input_text = [text.replace(' ', '') for text in user_input_text] @@ -609,11 +615,11 @@ def main(): # 250429기준 없는 시험 형식(A,B,C..)은 주석처리 하지 않으면 오류 발생 exam_types = [ 'A', - # 'B', - # 'C', + 'B', + 'C', ] - # test_mode = False - test_mode = True + test_mode = False + # test_mode = True output_excel_paths = [] for exam_type in exam_types: