2502회 채점자료 업로드
This commit is contained in:
45
score5.py
45
score5.py
@@ -82,7 +82,7 @@ class XMLScorer:
|
||||
|
||||
|
||||
# 유사한 텍스트 찾기
|
||||
def find_similar_text(self, root, target_text, threshold=0.6):
|
||||
def find_similar_text(self, root, target_text, threshold=0.7):
|
||||
"""
|
||||
전체 문서에서 유사한 텍스트를 찾아 반환
|
||||
|
||||
@@ -418,7 +418,8 @@ class XMLScorer:
|
||||
|
||||
def export_to_excel(self, results, output_path=None):
|
||||
if output_path is None:
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S") #연월일_시분초
|
||||
# timestamp = datetime.now().strftime("%Y%m%d") #연월일
|
||||
output_path = f"scoring_results_{timestamp}.xlsx"
|
||||
|
||||
summary_data = []
|
||||
@@ -515,26 +516,36 @@ class XMLScorer:
|
||||
|
||||
|
||||
def main():
|
||||
# scoring_criteria_path = r'./scoring_criteria.json'
|
||||
# scoring_criteria_path = r'./scoring_criteria_2512A.json'
|
||||
scoring_criteria_path = r'./scoring_criteria_2512B.json'
|
||||
# scoring_criteria_path = r'./scoring_criteria_2512C.json'
|
||||
# scoring_criteria_path = r'./scoring_criteria_2512D.json'
|
||||
# scoring_criteria_path = r'./DIW.json'
|
||||
scoring_criteria_path = r'./DIW_2502A.json'
|
||||
# scoring_criteria_path = r'./DIW_2502B.json'
|
||||
# scoring_criteria_path = r'./DIW_2502C.json'
|
||||
# scoring_criteria_path = r'./DIW_2502D.json'
|
||||
# scoring_criteria_path = r'./DIW_2502E.json'
|
||||
|
||||
# xml(hml)파일 디렉토리 경로
|
||||
xml_directory = r'./output'
|
||||
# xml_directory = r'./output/1교시'
|
||||
# xml_directory = r'./output/2교시'
|
||||
# xml_directory = r'./output/3교시'
|
||||
# xml_directory = r'./output/4교시'
|
||||
# xml_directory = r'./output'
|
||||
xml_directory = r'./output/A'
|
||||
# xml_directory = r'./output/B'
|
||||
# xml_directory = r'./output/C'
|
||||
# xml_directory = r'./output/D'
|
||||
# xml_directory = r'./output/E'
|
||||
|
||||
# 오탈자 체크를 위한 정답 파일 경로
|
||||
# answer_path = r'./output/정답.hml'
|
||||
# answer_path = r'./output/1교시/2512A.hml'
|
||||
answer_path = r'./output/2교시/2512B.hml'
|
||||
# answer_path = r'./output/3교시/2512C.hml'
|
||||
# answer_path = r'./output/4교시/2512D.hml'
|
||||
answer_path = r'./output/A/DIW_2502A.hml'
|
||||
# answer_path = r'./output/B/DIW_2502B.hml'
|
||||
# answer_path = r'./output/C/DIW_2502C.hml'
|
||||
# answer_path = r'./output/D/DIW_2502D.hml'
|
||||
# answer_path = r'./output/E/DIW_2502E.hml'
|
||||
|
||||
timestamp = datetime.now().strftime("%y%m%d")
|
||||
# 엑셀 파일명 (비어있으면 자동생성)
|
||||
output_path = f"{timestamp}_result_2502A.xlsx"
|
||||
# output_path = f"{timestamp}_result_2502B.xlsx"
|
||||
# output_path = f"{timestamp}_result_2502C.xlsx"
|
||||
# output_path = f"{timestamp}_result_2502D.xlsx"
|
||||
# output_path = f"{timestamp}_result_2502E.xlsx"
|
||||
|
||||
# 채점 클래스 초기화
|
||||
scorer = XMLScorer(scoring_criteria_path)
|
||||
@@ -543,7 +554,7 @@ def main():
|
||||
results = scorer.score_directory(xml_directory, answer_path)
|
||||
|
||||
# 채점 결과 엑셀로 저장
|
||||
output_excel_path = scorer.export_to_excel(results)
|
||||
output_excel_path = scorer.export_to_excel(results, output_path)
|
||||
print(f"채점 결과 엑셀 파일: {output_excel_path}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
Reference in New Issue
Block a user