오탈자 검사에서 오타와 추가된 글자는 감점에 포함하지 않고, 누락된 글자만 감점되도록 수정

This commit is contained in:
2025-02-13 18:19:14 +09:00
parent 2ec1b8dbd4
commit 99da118a40
13 changed files with 2054 additions and 543 deletions

View File

@@ -7,7 +7,7 @@ root_dir = r"./" # 탐색할 루트 디렉터리
output_root_dir = r"./" # 복사된 파일을 저장할 디렉터리
# 필요한 폴더 이름
target_folders = ["1교시", "2교시", "3교시"]
target_folders = ["1교시", "2교시", "3교시", "4교시"]
# 정규식 패턴
pattern = r'^워드\(한글\).*\.hwp$'

File diff suppressed because it is too large Load Diff

View File

@@ -349,6 +349,8 @@ class XMLScorer:
# 차이점을 정리하여 result_diff에 저장
result_diff = []
# 감점을 위한 누락 된 단어만 따로 리스트로 저장
missing_list = []
skip_next = False
for i, line in enumerate(diff_list):
@@ -357,14 +359,18 @@ class XMLScorer:
continue
# diff_list의 line 시작이 '-'이면서 다음 line이 '+'이면 두 line을 붙여서 맞춤법이 틀린 단어로 판단
if line.startswith('- '):
# 오타
if i + 1 < len(diff_list) and diff_list[i + 1].startswith('+ '):
line = line.replace('- ', '-')
next = diff_list[i + 1].replace('+ ', '')
result_diff.append(line+'=>'+next)
skip_next = True
# 누락
else:
line = line.replace('- ', '-')
result_diff.append(line)
missing_list.append(line)
# 없어도 되는 글자가 있는 경우
elif line.startswith('+ '):
line = line.replace('+ ', '+')
result_diff.append(line)
@@ -375,7 +381,8 @@ class XMLScorer:
# print(diff)
# result_diff 배열의 길이를 맨 앞에 저장
temp = 40 - min(len(result_diff)*2, 40)
# temp = 40 - min(len(result_diff)*2, 40)
temp = 40 - min(len(missing_list)*2, 40)
self.set_typo_score(temp)
result_diff.insert(0, temp)
@@ -515,17 +522,18 @@ def main():
scoring_criteria_path = r'./scoring_criteria_2512D.json'
# xml(hml)파일 디렉토리 경로
xml_directory = r'./output'
# xml_directory = r'./output'
# xml_directory = r'./output/1교시'
# xml_directory = r'./output/2교시'
# xml_directory = r'./output/3교시'
xml_directory = r'./output/4교시'
# 오탈자 체크를 위한 정답 파일 경로
# answer_path = r'./output/정답.hml'
# answer_path = r'./output/2512A.hml'
# answer_path = r'./output/2512B.hml'
# answer_path = r'./output/2512C.hml'
answer_path = r'./output/2512D.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'
# 채점 클래스 초기화

View File

@@ -495,13 +495,13 @@
"item": "문구 (MZ세대)/③ 크기 (9pt)"
},
"2-28":{
"path":"(count(//CHAR[contains(text(),'기원전')][contains(text(),'紀元前')])+count(//CHAR[contains(text(),'승전보')][contains(text(),'勝戰譜')])+count(//CHAR[contains(text(),'채택')][contains(text(),'採擇')])+count(//CHAR[contains(text(),'애국자')][contains(text(),'愛國者')])+count(//CHAR[contains(text(),'모금')][contains(text(),'募')]))*2",
"path":"(count(//CHAR[contains(text(),'기원전')][contains(text(),'紀元前')])+count(//CHAR[contains(text(),'승전보')][contains(text(),'勝戰譜')])+count(//CHAR[contains(text(),'채택')][contains(text(),'採擇')])+count(//CHAR[contains(text(),'애국자')][contains(text(),'愛國者')])+count(//CHAR[contains(text(),'모금')][contains(text(),'募')]))*2",
"path2": null,
"searchValue": null,
"value": 10,
"points": 10,
"category": "한자",
"item": "① 기원전(紀元前), ② 승전보(勝戰譜), ③ 채택(採擇), ④ 애국자(愛國者), ⑤ 모금(募)"
"item": "① 기원전(紀元前), ② 승전보(勝戰譜), ③ 채택(採擇), ④ 애국자(愛國者), ⑤ 모금(募)"
},
"2-29":{
"path":"boolean(//CHAR[contains(translate(text(), ' ', ''),'픽인아테')])",

View File

@@ -495,13 +495,13 @@
"item": "문구 (MZ세대)/③ 크기 (9pt)"
},
"2-28":{
"path":"(count(//CHAR[contains(text(),'기원전')][contains(text(),'紀元前')])+count(//CHAR[contains(text(),'승전보')][contains(text(),'勝戰譜')])+count(//CHAR[contains(text(),'채택')][contains(text(),'採擇')])+count(//CHAR[contains(text(),'애국자')][contains(text(),'愛國者')])+count(//CHAR[contains(text(),'모금')][contains(text(),'募')]))*2",
"path":"(count(//CHAR[contains(text(),'기원전')][contains(text(),'紀元前')])+count(//CHAR[contains(text(),'승전보')][contains(text(),'勝戰譜')])+count(//CHAR[contains(text(),'채택')][contains(text(),'採擇')])+count(//CHAR[contains(text(),'애국자')][contains(text(),'愛國者')])+count(//CHAR[contains(text(),'모금')][contains(text(),'募')]))*2",
"path2": null,
"searchValue": null,
"value": 10,
"points": 10,
"category": "한자",
"item": "① 기원전(紀元前), ② 승전보(勝戰譜), ③ 채택(採擇), ④ 애국자(愛國者), ⑤ 모금(募)"
"item": "① 기원전(紀元前), ② 승전보(勝戰譜), ③ 채택(採擇), ④ 애국자(愛國者), ⑤ 모금(募)"
},
"2-29":{
"path":"boolean(//CHAR[contains(translate(text(), ' ', ''),'픽인아테')])",