엑셀 '오타내역' 시트 파일명 출력 / 2505회 채점결과 추가
This commit is contained in:
@@ -832,7 +832,7 @@ class XMLScorer:
|
||||
except (KeyError, IndexError, AttributeError):
|
||||
ignore_word = None
|
||||
|
||||
print(f"ignore_word: {ignore_word}")
|
||||
# print(f"ignore_word: {ignore_word}")
|
||||
|
||||
# 리스트를 하나의 문자열로 변경
|
||||
user_input_text_str = ''.join(user_input_text)
|
||||
@@ -842,8 +842,7 @@ class XMLScorer:
|
||||
print(user_input_text_str)
|
||||
print("\ncurrect_input_text_answer as string:")
|
||||
print(currect_input_text_str)
|
||||
|
||||
|
||||
|
||||
# 문자열의 차이를 비교
|
||||
diff = difflib.ndiff(currect_input_text_str, user_input_text_str)
|
||||
diff_list = list(diff)
|
||||
@@ -998,18 +997,32 @@ class XMLScorer:
|
||||
detail_df.index = row_index
|
||||
# detail_df = pd.DataFrame(detail_data)
|
||||
|
||||
for temp in results:
|
||||
result = temp['typo']
|
||||
typo_data.append(result)
|
||||
for one_result in results:
|
||||
total_typo_err_score = one_result['typo'][0]
|
||||
typo_err_list = one_result['typo'][1:]
|
||||
|
||||
typo_row = {
|
||||
'파일명': one_result['score']['filename'],
|
||||
'오타점수': total_typo_err_score,
|
||||
}
|
||||
typo_row.update({f'오타{i+1}': typo_err for i, typo_err in enumerate(typo_err_list)})
|
||||
|
||||
typo_data.append(typo_row)
|
||||
|
||||
typo_df = pd.DataFrame(typo_data).transpose()
|
||||
# detail_df = pd.DataFrame(detail_data)
|
||||
# transpose 후 행 -> 열 변환했을 때의 인덱스 제거 (기본 인덱스 제거)
|
||||
typo_df.reset_index(drop=True, inplace=True)
|
||||
|
||||
# transpose 했으므로 첫 행을 컬럼명으로 지정
|
||||
typo_df.columns = typo_df.iloc[0] # 첫 행을 컬럼명으로 지정
|
||||
typo_df = typo_df.drop(typo_df.index[0]) # 첫 행 제거
|
||||
|
||||
|
||||
# ExcelWriter 객체 생성
|
||||
with pd.ExcelWriter(output_path, engine='openpyxl') as writer:
|
||||
summary_df.to_excel(writer, sheet_name='채점결과요약', index=False)
|
||||
detail_df.to_excel(writer, sheet_name='채점상세내역', index=True)
|
||||
typo_df.to_excel(writer, sheet_name='오타내역', index=False)
|
||||
summary_df.to_excel(writer, sheet_name='채점결과요약', index=False)
|
||||
|
||||
# 열 너비 자동 조정
|
||||
# for sheet_name in writer.sheets:
|
||||
@@ -1036,28 +1049,23 @@ def main():
|
||||
|
||||
# 채점하고자 하는 유형은 주석 해제
|
||||
exam_types = [
|
||||
# 'A',
|
||||
# 'B',
|
||||
# 'C',
|
||||
'D',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
# 'D',
|
||||
]
|
||||
|
||||
# test_mode = False
|
||||
test_mode = True #/TEST 폴더 채점시
|
||||
test_mode = False
|
||||
# test_mode = True #/TEST 폴더 채점시
|
||||
|
||||
output_excel_paths = []
|
||||
for exam_type in exam_types:
|
||||
# JSON 채점기준표 파일 (예시:DIW_2503A.json)
|
||||
# scoring_criteria_path = f'./DIW_{exam_round}.json'
|
||||
scoring_criteria_path = f'./DIW_{exam_round}{exam_type}.json'
|
||||
|
||||
# xml(hml)파일 디렉토리 경로 (예시:./output/A/DIW)
|
||||
# xml_directory = f'./output/{exam_type}/{"TEST" if test_mode else "DIW"}'
|
||||
|
||||
# 회차가 여러개인 경우
|
||||
# xml(hml)파일 디렉토리 경로 (예시:./output/2503/A/DIW)
|
||||
xml_directory = f'./output/{exam_round}/{exam_type}/{"TEST" if test_mode else "DIW"}'
|
||||
|
||||
|
||||
# 오탈자 체크를 위한 정답 파일 경로 (예시:./output/A/DIW/DIW_2503A.hml)
|
||||
# correct_answer_file = f'./output/{exam_type}/DIW/DIW_{exam_round}{exam_type}.hml'
|
||||
correct_answer_file = f'./output/{exam_round}/{exam_type}/DIW/DIW_{exam_round}{exam_type}.hml'
|
||||
|
||||
Reference in New Issue
Block a user