2505회 수정요청사항 적용
This commit is contained in:
@@ -605,14 +605,38 @@ class XMLScorer:
|
||||
|
||||
for elem in p.iter():
|
||||
# 시작 지점 확인
|
||||
# FIELDBEGIN태그와 FIELDEND태그 사이
|
||||
if elem.tag == "FIELDBEGIN":
|
||||
inside_field = True
|
||||
elif elem.tag == "FIELDEND":
|
||||
inside_field = False
|
||||
|
||||
# 하이퍼링크 텍스트가 CharShape 속성값이 앞의 텍스트와 다른 경우
|
||||
# http://www.ihd.or.kr 주소가 TEXT 부모태그를 가지는 경우
|
||||
# [예시]
|
||||
# <TEXT CharShape="21">
|
||||
# <CHAR>http://www.ihd.or.kr)</CHAR>
|
||||
# </TEXT>
|
||||
# 해당 부모 TEXT태그의 CharShape속성을 확인
|
||||
elif inside_field and elem.tag == "TEXT":
|
||||
charshape = elem.get("CharShape")
|
||||
print('charshape : ', charshape)
|
||||
if charshape:
|
||||
charshape_list.append(charshape)
|
||||
|
||||
# 하이퍼링크 텍스트가 CharShape 속성값이 앞의 텍스트와 같은 경우
|
||||
# http://www.ihd.or.kr 주소가 TEXT부모태그 없이 CHAR로만 있는경우
|
||||
# [예시]
|
||||
# <CHAR>http://www.ihd.or.kr)</CHAR>
|
||||
# FIELDBEGIN밖의 TEXT태그의 CharShape속성을 확인해야 한다
|
||||
elif inside_field and elem.tag == "CHAR":
|
||||
parent = elem.getparent()
|
||||
|
||||
charshape = parent.get("CharShape")
|
||||
print('charshape : ', charshape)
|
||||
if charshape:
|
||||
charshape_list.append(charshape)
|
||||
|
||||
|
||||
# 하이퍼링크에 해당하는 P태그 내 존재하는 charshape ID값 모두를 비교해 해당 속성(ITALIC, BOLD, UNDERLINE) 확인
|
||||
# 모든 charshape ID값이 정답과 일치하는 경우에만 점수 부여
|
||||
@@ -636,7 +660,37 @@ class XMLScorer:
|
||||
else:
|
||||
self.evaluate_answer(scoring, user_answer, right_answer, 0, method="equal")
|
||||
|
||||
elif (category or "") == "LineSpacing":
|
||||
# //SECTION[1](1페이지의) 모든 P요소
|
||||
all_p_tags = root.xpath("//SECTION[1]/P")
|
||||
|
||||
# 구역이 나뉘어 있지 않은 답안의 처리
|
||||
# 수험자가 구역 나눔을 적용하지 않고 2페이지 답안을 처리하기 위해서
|
||||
# [Control+Enter]를 이용해 쪽 나눔을 적용하는 부분을 검색
|
||||
# P태그의 PageBreak속성값이 'true'가 나오기 전까지의 P태그만 확인
|
||||
p_tags_before_pagebreak = []
|
||||
for p in all_p_tags:
|
||||
if p.get('PageBreak') == 'true':
|
||||
break
|
||||
else:
|
||||
p_tags_before_pagebreak.append(p)
|
||||
|
||||
# 줄간격이 하나라도 일치하지 않을 경우 오답처리
|
||||
linespacing_match = True
|
||||
for p in p_tags_before_pagebreak:
|
||||
parashape_id = p.get('ParaShape')
|
||||
xpath = xpath.replace('{parashape_id}', parashape_id)
|
||||
linespacing = root.xpath(xpath)
|
||||
user_answer = linespacing[0]
|
||||
|
||||
if user_answer != right_answer:
|
||||
linespacing_match = False
|
||||
break
|
||||
|
||||
if linespacing_match is True:
|
||||
self.evaluate_answer(scoring, user_answer, right_answer, points, method="equal")
|
||||
else:
|
||||
self.evaluate_answer(scoring, user_answer, right_answer, 0, method="equal")
|
||||
|
||||
|
||||
# 특수문자 갯수 채점
|
||||
@@ -1082,8 +1136,8 @@ def main():
|
||||
# 채점하고자 하는 유형은 주석 해제
|
||||
exam_types = [
|
||||
# 'A',
|
||||
# 'B',
|
||||
'C',
|
||||
'B',
|
||||
# 'C',
|
||||
# 'D',
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user