2508회 채점기준 최종수정
This commit is contained in:
@@ -178,34 +178,6 @@ class XMLScorer:
|
||||
page_start_index = None
|
||||
|
||||
return pages
|
||||
# def parse_pages_by_bookmark(root):
|
||||
# """
|
||||
# BOOKMARK(Name="Page_X_start" ~ "Page_X_end") 사이의 <P> 요소들을
|
||||
# 페이지 단위로 딕셔너리에 저장
|
||||
# """
|
||||
# pages = {}
|
||||
# all_p_tags = root.xpath('//P')
|
||||
|
||||
# current_page = None
|
||||
# page_start_index = None
|
||||
|
||||
# for i, p in enumerate(all_p_tags):
|
||||
# # P 안의 모든 BOOKMARK 탐색
|
||||
# bookmarks = p.xpath('.//BOOKMARK')
|
||||
# for bm in bookmarks:
|
||||
# name = bm.get('Name')
|
||||
# if name and name.endswith('_start'):
|
||||
# current_page = name.replace('_start', '')
|
||||
# page_start_index = i
|
||||
# elif name and name.endswith('_end') and current_page is not None:
|
||||
# page_end_index = i
|
||||
# # 시작~끝까지 P 태그 묶음 저장
|
||||
# page_content = all_p_tags[page_start_index:page_end_index + 1]
|
||||
# pages[current_page] = page_content
|
||||
# current_page = None
|
||||
# page_start_index = None
|
||||
|
||||
# return pages
|
||||
|
||||
def extract_char_text_from_p(p_element):
|
||||
"""
|
||||
@@ -510,7 +482,6 @@ class XMLScorer:
|
||||
elif "TextBoxAlign" in (category or ""):
|
||||
if has_page2_rectangle:
|
||||
parashape_list = rect_parashapes
|
||||
|
||||
else:
|
||||
parashape_list = root.xpath(xpath)
|
||||
|
||||
@@ -521,7 +492,6 @@ class XMLScorer:
|
||||
exec_xpath = xpath.replace('{rect_parashape_id}', parashape_id)
|
||||
items = root.xpath(exec_xpath)
|
||||
result_items.extend(items)
|
||||
|
||||
else:
|
||||
# RECTANGLE이 없으면 items는 빈 리스트
|
||||
items = [None]
|
||||
@@ -532,17 +502,6 @@ class XMLScorer:
|
||||
if scoring['points'] > 0:
|
||||
break
|
||||
|
||||
# if has_page2_rectangle:
|
||||
# # 2페이지 내에서만 검색
|
||||
# search_root = etree.Element("Page_2")
|
||||
# for p in page2_ptags:
|
||||
# search_root.append(p)
|
||||
# rect_parashape_id = search_root.xpath(".//RECTANGLE/ancestor::P[last()]/@ParaShape")
|
||||
|
||||
# else:
|
||||
# # 전체 root에서 검색
|
||||
# rect_parashape_id = root.xpath(".//RECTANGLE/ancestor::P[last()]/@ParaShape")
|
||||
|
||||
# 정답이 하나인 경우
|
||||
# elif (category or "") in ["OneAnswer", "ChartOneAnswer"]:
|
||||
elif "OneAnswer" in (category or ""):
|
||||
@@ -619,21 +578,8 @@ class XMLScorer:
|
||||
items.extend(p.xpath(xpath))
|
||||
|
||||
else:
|
||||
# print(etree.tostring(root, pretty_print=True, encoding="unicode"))
|
||||
|
||||
# 단계별 점검
|
||||
# print("1) PICTURE 태그 존재 여부:", root.xpath("//PICTURE"))
|
||||
# print("2) BINITEM 태그 존재 여부:", root.xpath("//BINITEM"))
|
||||
# print("3) BINITEM Format 값:", root.xpath("//BINITEM/@Format"))
|
||||
# print("4) BINITEM BinData 값:", root.xpath("//BINITEM/@BinData"))
|
||||
# print("5) IMAGE BinItem 값:", root.xpath("//IMAGE/@BinItem"))
|
||||
# print("6) PICTURE 안의 IMAGE 존재 여부:", root.xpath("//PICTURE/IMAGE"))
|
||||
# print("7) SIZE Width 값:", root.xpath("//PICTURE/SHAPEOBJECT/SIZE/@Width"))
|
||||
|
||||
# 원래 쓰시던 XPath 그대로 결과 확인
|
||||
|
||||
# print("8) 원래 XPath 결과:", root.xpath(xpath_expr))
|
||||
items = root.xpath(xpath)
|
||||
|
||||
# 오차범위 설정
|
||||
# 한글 프로그램 내부에서 드물게 0mm이지만 1pt로 저장되는 경우가 있음
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user