차트 제목 오탈자 검사항목에 추가
This commit is contained in:
@@ -358,20 +358,29 @@ class XMLScorer:
|
||||
|
||||
return xml_data
|
||||
|
||||
def typo_check(self, correct_answer_file, user_answer_file):
|
||||
def typo_check(self, correct_answer_file, user_answer_file, chart_xml):
|
||||
user_answer_tree = ET.parse(user_answer_file)
|
||||
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)
|
||||
|
||||
# 각 요소에서 공백 제거
|
||||
user_input_text = [text.replace(' ', '') for text in user_input_text]
|
||||
@@ -478,7 +487,7 @@ class XMLScorer:
|
||||
for user_answer_file in xml_files:
|
||||
result = {}
|
||||
chart_xml = self.binary_to_chartxml(user_answer_file)
|
||||
result['typo'] = self.typo_check(correct_answer_file, user_answer_file)
|
||||
result['typo'] = self.typo_check(correct_answer_file, user_answer_file, chart_xml)
|
||||
result['score'] = self._score_xml_file(user_answer_file, chart_xml)
|
||||
# result['score']['score_results'][2]['points'] = result['typo'][0]
|
||||
results.append(result)
|
||||
@@ -595,13 +604,13 @@ class XMLScorer:
|
||||
def main():
|
||||
|
||||
# 시험회차 및 유형
|
||||
exam_round = '2504_3'
|
||||
exam_round = '2504'
|
||||
|
||||
# 250429기준 없는 시험 형식(A,B,C..)은 주석처리 하지 않으면 오류 발생
|
||||
exam_types = [
|
||||
# 'A',
|
||||
'A',
|
||||
# 'B',
|
||||
'C',
|
||||
# 'C',
|
||||
]
|
||||
# test_mode = False
|
||||
test_mode = True
|
||||
|
||||
Reference in New Issue
Block a user