TABLE태그안의 텍스트 위치 일정하게 뒤에 배치해서 오탈자 채점하도록 수정

This commit is contained in:
2025-02-06 14:48:54 +09:00
parent 893517392b
commit e229a8eaef
7 changed files with 151 additions and 146 deletions

View File

@@ -315,8 +315,13 @@ class XMLScorer:
root_origin = tree_origin.getroot()
# xpath로 바이너리 부분추출
input_text = root.xpath('//CHAR//text()[not(ancestor::HEADER)]')
input_text_origin = root_origin.xpath('//CHAR//text()[not(ancestor::HEADER)]')
input_text = root.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]')
table_text = root.xpath('//TABLE//CHAR//text()')
input_text += table_text
input_text_origin = root_origin.xpath('//CHAR//text()[not(ancestor::HEADER) and not(ancestor::TABLE)]')
talbe_text_origin = root_origin.xpath('//TABLE//CHAR//text()')
input_text_origin += talbe_text_origin
# 각 요소에서 공백 제거
input_text = [text.replace(' ', '') for text in input_text]