오탈자 검사 부분 '누락된단어'만 감점하다가 '누락된단어'와 '오타'까지 감점 허용
This commit is contained in:
31
score5.py
31
score5.py
@@ -351,6 +351,10 @@ class XMLScorer:
|
||||
result_diff = []
|
||||
# 감점을 위한 누락 된 단어만 따로 리스트로 저장
|
||||
missing_list = []
|
||||
|
||||
# 오타와 누락된 단어 리스트 저장
|
||||
error_missing_list = []
|
||||
|
||||
skip_next = False
|
||||
|
||||
for i, line in enumerate(diff_list):
|
||||
@@ -364,12 +368,14 @@ class XMLScorer:
|
||||
line = line.replace('- ', '-')
|
||||
next = diff_list[i + 1].replace('+ ', '')
|
||||
result_diff.append(line+'=>'+next)
|
||||
error_missing_list.append(line+'=>'+next)
|
||||
skip_next = True
|
||||
# 누락
|
||||
else:
|
||||
line = line.replace('- ', '-')
|
||||
result_diff.append(line)
|
||||
missing_list.append(line)
|
||||
error_missing_list.append(line)
|
||||
# 없어도 되는 글자가 있는 경우
|
||||
elif line.startswith('+ '):
|
||||
line = line.replace('+ ', '+')
|
||||
@@ -381,8 +387,15 @@ class XMLScorer:
|
||||
# print(diff)
|
||||
|
||||
# result_diff 배열의 길이를 맨 앞에 저장
|
||||
|
||||
# 모든 차이를 계산해 점수 차감
|
||||
# temp = 40 - min(len(result_diff)*2, 40)
|
||||
temp = 40 - min(len(missing_list)*2, 40)
|
||||
|
||||
# 누락된 텍스트만 계산해 점수 차감
|
||||
# temp = 40 - min(len(missing_list)*2, 40)
|
||||
|
||||
temp = 40 - min(len(error_missing_list)*2, 40)
|
||||
|
||||
self.set_typo_score(temp)
|
||||
|
||||
result_diff.insert(0, temp)
|
||||
@@ -518,35 +531,35 @@ class XMLScorer:
|
||||
def main():
|
||||
# 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_2502B.json'
|
||||
# scoring_criteria_path = r'./DIW_2502C.json'
|
||||
# scoring_criteria_path = r'./DIW_2502D.json'
|
||||
# scoring_criteria_path = r'./DIW_2502E.json'
|
||||
scoring_criteria_path = r'./DIW_2502E.json'
|
||||
|
||||
# xml(hml)파일 디렉토리 경로
|
||||
# xml_directory = r'./output'
|
||||
# xml_directory = r'./output/A'
|
||||
xml_directory = r'./output/B'
|
||||
# xml_directory = r'./output/B'
|
||||
# xml_directory = r'./output/C'
|
||||
# xml_directory = r'./output/D'
|
||||
# xml_directory = r'./output/E'
|
||||
xml_directory = r'./output/E'
|
||||
|
||||
|
||||
# 오탈자 체크를 위한 정답 파일 경로
|
||||
# answer_path = r'./output/정답.hml'
|
||||
# answer_path = r'./output/A/DIW_2502A.hml'
|
||||
answer_path = r'./output/B/DIW_2502B.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'
|
||||
answer_path = r'./output/E/DIW_2502E.hml'
|
||||
|
||||
timestamp = datetime.now().strftime("%y%m%d")
|
||||
# 엑셀 파일명 (비어있으면 자동생성)
|
||||
# output_path = f"{timestamp}_DIW_2502A_채점결과.xlsx"
|
||||
output_path = f"{timestamp}_DIW_2502B_채점결과.xlsx"
|
||||
# output_path = f"{timestamp}_DIW_2502B_채점결과.xlsx"
|
||||
# output_path = f"{timestamp}_DIW_2502C_채점결과.xlsx"
|
||||
# output_path = f"{timestamp}_DIW_2502D_채점결과.xlsx"
|
||||
# output_path = f"{timestamp}_DIW_2502E_채점결과.xlsx"
|
||||
output_path = f"{timestamp}_DIW_2502E_채점결과.xlsx"
|
||||
|
||||
# 채점 클래스 초기화
|
||||
scorer = XMLScorer(scoring_criteria_path)
|
||||
|
||||
Reference in New Issue
Block a user