2-25 각주 채점기준변경
This commit is contained in:
73
score5.py
73
score5.py
@@ -153,6 +153,9 @@ class XMLScorer:
|
||||
|
||||
print(f"File name: {results['filename']}")
|
||||
|
||||
|
||||
|
||||
|
||||
for criterion_id, criterion in self.scoring_criteria.items():
|
||||
|
||||
# 키값의 첫 숫자를 확인
|
||||
@@ -331,8 +334,16 @@ class XMLScorer:
|
||||
# 숫자와 특정 형식 제거 (예: 1., 2., 3., -)
|
||||
input_text = [re.sub(r'\d+\.\s*|-', '', text) for text in input_text]
|
||||
input_text_origin = [re.sub(r'\d+\.\s*|-', '', text) for text in input_text_origin]
|
||||
|
||||
|
||||
|
||||
# ignore_word = self.scoring_criteria["2-29"]['path'].split("'")[1]
|
||||
# print(f"ignore_word: {ignore_word}")
|
||||
# # 특정 단어 제거
|
||||
# # 오타와 누락의 경우만 판단하면 정상작동하지만
|
||||
# # 추가 된 단어의 경우를 채점기준에 추가하면 정확하게 채점 되지 않을 수 있음
|
||||
# # [정답] Hybrid [실제작성]
|
||||
# input_text = [text.replace(ignore_word, '') for text in input_text]
|
||||
# input_text_origin = [text.replace(ignore_word, '') for text in input_text_origin]
|
||||
|
||||
# 리스트를 하나의 문자열로 변경
|
||||
input_text_str = ''.join(input_text)
|
||||
input_text_origin_str = ''.join(input_text_origin)
|
||||
@@ -350,7 +361,7 @@ class XMLScorer:
|
||||
# 차이점을 정리하여 result_diff에 저장
|
||||
result_diff = []
|
||||
|
||||
# 감점을 위한 누락 된 단어만 따로 리스트로 저장
|
||||
# 누락 된 단어만 따로 리스트로 저장
|
||||
missing_list = []
|
||||
|
||||
# 오타와 누락된 단어 리스트 저장
|
||||
@@ -377,7 +388,7 @@ class XMLScorer:
|
||||
result_diff.append(line)
|
||||
missing_list.append(line)
|
||||
error_missing_list.append(line)
|
||||
# 없어도 되는 글자가 있는 경우
|
||||
# 없어도 되는 글자가 있는 경우 (추가)
|
||||
elif line.startswith('+ '):
|
||||
line = line.replace('+ ', '+')
|
||||
result_diff.append(line)
|
||||
@@ -531,34 +542,42 @@ class XMLScorer:
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
# 시험회차 및 유형
|
||||
exam_round = '2503'
|
||||
# exam_type = 'A'
|
||||
# exam_type = 'B'
|
||||
exam_type = 'C'
|
||||
# exam_type = 'D'
|
||||
# exam_type = 'E'
|
||||
exam_types = [
|
||||
# 'A',
|
||||
'B',
|
||||
# 'C',
|
||||
]
|
||||
# test_mode = False
|
||||
test_mode = True
|
||||
|
||||
scoring_criteria_path = f'./DIW_{exam_round}{exam_type}.json'
|
||||
# xml(hml)파일 디렉토리 경로
|
||||
xml_directory = f'./output/{exam_type}/DIW'
|
||||
output_excel_paths = []
|
||||
for exam_type in exam_types:
|
||||
scoring_criteria_path = f'./DIW_{exam_round}{exam_type}.json'
|
||||
# xml(hml)파일 디렉토리 경로
|
||||
|
||||
xml_directory = f'./output/{exam_type}/{"TEST" if test_mode else "DIW"}'
|
||||
|
||||
|
||||
# 오탈자 체크를 위한 정답 파일 경로
|
||||
answer_path = f'./output/{exam_type}/DIW/DIW_{exam_round}{exam_type}.hml'
|
||||
# 오탈자 체크를 위한 정답 파일 경로 (형식:DIW_2503A.hml)
|
||||
answer_path = f'./output/{exam_type}/DIW/DIW_{exam_round}{exam_type}.hml'
|
||||
|
||||
# 엑셀 파일명 (비어있으면 자동생성)
|
||||
timestamp = datetime.now().strftime("%y%m%d")
|
||||
output_path = f'{timestamp}_DIW_{exam_round}{exam_type}_{"TEST" if test_mode else "채점결과"}.xlsx'
|
||||
|
||||
# 채점 클래스 초기화
|
||||
scorer = XMLScorer(scoring_criteria_path)
|
||||
|
||||
# 폴더 내 모든 xml 파일 채점
|
||||
results = scorer.score_directory(xml_directory, answer_path)
|
||||
|
||||
# 엑셀 파일명 (비어있으면 자동생성)
|
||||
timestamp = datetime.now().strftime("%y%m%d")
|
||||
output_path = f"{timestamp}_DIW_{exam_round}{exam_type}_채점결과.xlsx"
|
||||
|
||||
# 채점 클래스 초기화
|
||||
scorer = XMLScorer(scoring_criteria_path)
|
||||
|
||||
# 폴더 내 모든 xml 파일 채점
|
||||
results = scorer.score_directory(xml_directory, answer_path)
|
||||
|
||||
# 채점 결과 엑셀로 저장
|
||||
output_excel_path = scorer.export_to_excel(results, output_path)
|
||||
print(f"채점 결과 엑셀 파일: {output_excel_path}")
|
||||
# 채점 결과 엑셀로 저장
|
||||
output_excel_paths.append(scorer.export_to_excel(results, output_path))
|
||||
|
||||
print(f"채점 결과 엑셀 파일: {output_excel_paths}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user