2501회 A/B/C 채점기준 JSON파일작성
This commit is contained in:
63
score5.py
63
score5.py
@@ -1,3 +1,5 @@
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog, messagebox
|
||||
from datetime import datetime
|
||||
import difflib
|
||||
import json
|
||||
@@ -510,27 +512,52 @@ def main():
|
||||
# 폴더 내 모든 xml 파일 채점
|
||||
results = scorer.score_directory(xml_directory, answer_path)
|
||||
|
||||
# for result in results:
|
||||
# print(f"\n파일: {result['filename']}")
|
||||
# if 'error' in result:
|
||||
# print(f"오류: {result['error']}")
|
||||
# continue
|
||||
|
||||
# print(f"총점: {result['total_score']}")
|
||||
# print("\n채점 세부사항:")
|
||||
# for scoring in result['score_results']:
|
||||
# print(f"채점분류: {scoring['category']}")
|
||||
# print(f"채점항목: {scoring['item']}")
|
||||
# print(f"요구 답안: {scoring['right_answer']}")
|
||||
# print(f"작성 답안: {scoring['actual_answer']}")
|
||||
# print(f"획득 점수: {scoring['points']}")
|
||||
# print(f"감점 내역: {scoring['deductions']}")
|
||||
# print("---")
|
||||
|
||||
# 채점 결과 엑셀로 저장
|
||||
output_excel_path = scorer.export_to_excel(results)
|
||||
print(f"채점 결과 엑셀 파일: {output_excel_path}")
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
||||
# def select_file():
|
||||
# # file_path = filedialog.askopenfilename(filetypes=[("XML and HML files", "*.xml *.hml"), ("All files", "*.*")])
|
||||
# file_path = filedialog.askopenfilename(filetypes=[("HWPML files", "*.hml"), ("All files", "*.*")], initialdir='./output')
|
||||
# # file_path = filedialog.askdirectory(initialdir='./output')
|
||||
|
||||
# if file_path:
|
||||
# file_entry.delete(0, tk.END)
|
||||
# file_entry.insert(0, file_path)
|
||||
|
||||
# def export_results():
|
||||
# file_path = file_entry.get()
|
||||
# if not file_path:
|
||||
# messagebox.showerror("Error", "파일을 선택하세요.")
|
||||
# return
|
||||
|
||||
# # XMLScorer 인스턴스 생성 및 파일 처리
|
||||
# scoring_criteria_path = r'./scoring_criteria.json'
|
||||
# scorer = XMLScorer(scoring_criteria_path)
|
||||
# results = [] # 실제로는 XML 파일을 처리하여 결과를 생성해야 함
|
||||
# scorer.export_to_excel(results, output_path=file_path)
|
||||
# messagebox.showinfo("Success", "엑셀 파일이 성공적으로 저장되었습니다.")
|
||||
|
||||
# # GUI 설정
|
||||
# root = tk.Tk()
|
||||
# root.title("XML Scorer")
|
||||
|
||||
# frame = tk.Frame(root)
|
||||
# frame.pack(padx=10, pady=10)
|
||||
|
||||
# file_label = tk.Label(frame, text="파일 선택:")
|
||||
# file_label.grid(row=0, column=0, padx=5, pady=5)
|
||||
|
||||
# file_entry = tk.Entry(frame, width=50)
|
||||
# file_entry.grid(row=0, column=1, padx=5, pady=5)
|
||||
|
||||
# file_button = tk.Button(frame, text="Browse", command=select_file)
|
||||
# file_button.grid(row=0, column=2, padx=5, pady=5)
|
||||
|
||||
# export_button = tk.Button(frame, text="Export to Excel", command=export_results)
|
||||
# export_button.grid(row=1, column=0, columnspan=3, pady=10)
|
||||
|
||||
# root.mainloop()
|
||||
Reference in New Issue
Block a user