import sys, os, re sys.stdout.reconfigure(encoding='utf-8') # 1. 01_공통부문/제1장_적용기준.md 의 1-2-7 적재량 표 복원 fpath_ch1 = "resources/knowledge/original/원가계산/건설공사_표준품셈/01_공통부문/제1장_적용기준.md" with open(fpath_ch1, 'r', encoding='utf-8') as f: text1 = f.read() # Pattern in 1-2-7: table with 주철관, 도복장강관, PC파일, 시멘트, 전주 # Let's inspect where collapsed table in 1-2-7 is pattern_127 = re.compile(r'\|\s*주\s*철\s*관.*?\|\n', re.DOTALL) m127 = pattern_127.search(text1) if m127: print(f"1-2-7 collapsed row found, len={len(m127.group(0))}") restored_127 = """| 주 철 관 | ø80㎜∼150㎜ L=6.0m | 본 | 42∼111 | 46∼123 | - | - | | | 〃 | 200∼450 〃 | 〃 | 9∼30 | 10∼34 | - | - | | | 〃 | 500∼600 〃 | 〃 | 6 | 6∼9 | - | - | | | 〃 | 700∼900 〃 | 〃 | 3 | 3∼5 | - | - | | | 〃 | 1,000〃 | 〃 | 2 | 2 | - | - | | | 도복장강관 | ø300㎜∼450㎜ L=6.0m | 본 | 10∼18 | 14∼22 | - | - | | | 〃 | 500∼700〃 | 〃 | 3∼9 | 6∼10 | - | - | | | 〃 | 800∼1,000〃 | 〃 | 1∼3 | 3 | - | - | | | 〃 | 1,200∼2,100〃 | 〃 | 1 | 1 | - | - | | | 〃 | 2,200∼2,300〃 | 〃 | - | 1 | - | - | | | P ・C 파일 | ø300㎜∼440㎜ L=9.0m | 본 | - | - | 6∼10 | 11∼18 | | | 〃 | 450∼500 〃 | 〃 | - | - | 4∼5 | 8∼9 | | | 시 멘 트 | 40㎏ | 대 | 150 | 200 | 275 | 637 | (25.5톤 화물차는 풀카고 기준) | | 전 주 | 10m(일반용) | 본 | - | - | 12 | 23 | | | 〃 | 체신주 8m | 〃 | - | 17 | 23 | 43 | |""" text1 = text1[:m127.start()] + restored_127 + '\n' + text1[m127.end():] with open(fpath_ch1, 'w', encoding='utf-8') as f: f.write(text1) print("1-2-7 table restored successfully!") else: print("1-2-7 collapsed row not matched.") # 2. 1-3-1 재료할증 사석표 복원 # check if 사석 table collapsed in ch1 pattern_131 = re.compile(r'\|\s*기\s*초\s*사\s*석.*?\|\n', re.DOTALL) m131 = pattern_131.search(text1) if m131: print(f"1-3-1 사석 collapsed row found, len={len(m131.group(0))}") restored_131 = """| 기 초 사 석 | 25% | 20% | 30% | 25% | 50% | 40% | | 피 복 석 ( 被 覆 石 ) | 15% | 15% | 15% | 15% | 20% | 20% | | 뒤 채 움 사 석 | 20% | 20% | 20% | 20% | 25% | 25% |""" text1 = text1[:m131.start()] + restored_131 + '\n' + text1[m131.end():] with open(fpath_ch1, 'w', encoding='utf-8') as f: f.write(text1) print("1-3-1 사석 table restored successfully!") # 3. 03_건축부문/제9장_미장공사.md 모르타르 배합표 점검 fpath_ch9 = "resources/knowledge/original/원가계산/건설공사_표준품셈/03_건축부문/제9장_미장공사.md" with open(fpath_ch9, 'r', encoding='utf-8') as f: text9 = f.read() # Let's inspect collapsed row in 제9장 print("\n--- Inspecting collapsed rows in 제9장_미장공사.md ---") for l in text9.split('\n'): if l.strip().startswith('|') and l.strip().endswith('|'): tokens = l.split() if len(tokens) >= 15: print(f"Collapsed row: {l[:100]}...")