[표 첫행 색상] 채점 기준 추가적용

This commit is contained in:
devdra9
2025-01-21 15:15:44 +09:00
parent 141d62cd74
commit c5fe09108c
4 changed files with 30 additions and 7 deletions

View File

@@ -32,10 +32,13 @@ class XMLScorer:
first_xpath = args[0]
second_xpath = args[1]
points = args[2]
category = args[3]
if second_xpath is not None:
if ("특수문자" in category) and (second_xpath is not None):
try:
result = root.xpath(first_xpath)
# 결과값이 리스트형인데 내부에 정보가 없는경우
# 결과값이 없음
if type(result) is list and len(result) == 0:
return None
elif result < points:
@@ -46,12 +49,24 @@ class XMLScorer:
except ET.XPathEvalError as e:
return None
elif second_xpath is not None:
try:
# result = root.xpath(first_xpath)
result1 = root.xpath(first_xpath)
result2 = root.xpath(second_xpath)
if (type(result1) is list and len(result1) == 0) and (type(result2) is list and len(result2) == 0):
return None
return result1 if result1 else result2
except ET.XPathEvalError as e:
return None
else:
try:
result = root.xpath(first_xpath)
if type(result) is list and len(result) == 0:
return None
return result
except ET.XPathEvalError as e:
return None
@@ -175,7 +190,7 @@ class XMLScorer:
else:
xpath = xpath.replace('{searchValue}', simliar_text)
result = self.query_xml(root, xpath, xpath2, points)
result = self.query_xml(root, xpath, xpath2, points, category)
# [ boolean 타입 ]
# 1. 이텔릭체, 굵게, 밑줄 등 효과가 적용 여부에 따라
@@ -445,8 +460,6 @@ class XMLScorer:
typo_df = pd.DataFrame(typo_data).transpose()
# detail_df = pd.DataFrame(detail_data)
# detail_df.iloc[3] = typo_df.iloc[0]
# ExcelWriter 객체 생성
with pd.ExcelWriter(output_path, engine='openpyxl') as writer: