Files
Aislo/resources/tester/scratch/sync_merged_with_split.py
T

125 lines
5.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import sys, os, re
sys.stdout.reconfigure(encoding='utf-8')
merged_file = "resources/knowledge/original/원가계산/건설공사_표준품셈/2026년_건설공사_표준품셈.md"
with open(merged_file, 'r', encoding='utf-8') as f:
text = f.read()
# 1. Restore (7101) 고성능 착정기 in merged file
# Find line around 8192
pattern_7101 = re.compile(r'\[주\]\s*①\s*샹크.*?\(7101\)[^\n]+\(7103\)', re.DOTALL)
m7101 = pattern_7101.search(text)
if m7101:
print(f"Matched 7101 in merged, len={len(m7101.group(0))}")
restored_7101 = """[주] ① 샹크, 로드, 비트, 캡 등 부속장비가 포함되어 있다.
(7101) 고성능 착정기
| 분류 번호 | 규 격 | 내용 시간 | 연간 표준 가동 시간 | 상각 비율 | 정비 비율 | 연간 관리 비율 | 시 간 당(10-7) | | | |
|---|---|---|---|---|---|---|---|---|---|---|
| | | | | | | | 상각비 계수 | 정비비 계수 | 관리비 계수 | 계 |
| 7101-0450 | 335.70㎾ | 6,300 | 800 | 0.9 | 0.65 | 0.1 | 1,429 | 1,032 | 759 | 3,220 |
[주] ① 트럭 적재식이고 공기압축기 및 동력이 포함되어 있다.
- ② 로드, 비트, 케이싱 등은 별도 계상한다.
- ③ 지하수개발용이다.
(7103)"""
text = text[:m7101.start()] + restored_7101 + text[m7101.end()-6:]
print("Successfully restored (7101) in merged file!")
else:
print("Could not match 7101 pattern in merged file.")
# 2. Restore 1-2-2 in merged file
pattern_122 = re.compile(r'\|\s*돌\s*쌓\s*기\s*및\s*돌\s*붙\s*임\s*사\s*석.*?\n', re.DOTALL)
m122 = pattern_122.search(text)
if m122:
print(f"Matched 1-2-2 in merged, len={len(m122.group(0))}")
restored_122 = """| 돌 쌓 기 및 돌 붙 임 | ㎝ | - | ㎡ | 1 | |
| 사 석 ( 捨 石 ) | ㎝ | - | ㎥ | 1 | |
| 다 듬 돌 ( 切 石 , 板 石 ) | ㎝ | - | 개 | 2 | |
| 벽 돌 | ㎜ | - | 개 | - | |
| 블 록 | ㎜ | - | 개 | - | |
| 시 멘 트 | - | - | ㎏ | - | |
| 모 르 타 르 | - | - | ㎥ | 2 | |
| 콘 크 리 트 | - | - | ㎥ | 2 | |
| 석 분 | - | - | ㎏ | - | |
| 석 회 | - | - | ㎏ | - | |
| 화 산 회 | - | - | ㎏ | - | |
| 아 스 팔 트 | - | - | ㎏ | - | |
| 목 재 ( 판 재 ) | 길이m | 1 | ㎡ | 2 | |
| 목 재 ( 판 재 ) | 폭,두께 | 1 | ㎥ | 3 | |
| 목 재 ( 판 재 ) | ㎝ | 1 | ㎥ | 3 | |
| 합 판 | ㎜ | - | 장 | 1 | |
| 말 뚝 | 길이m 지름㎜ | 1 - | 개 | - | |
| 철 강 재 | ㎜ | - | ㎏ | 3 | 총량표시는 ton으로 한다. |
| 용 접 봉 | ㎜ | - | ㎏ | 1 | |
| 구 리 판 , 함 석 류 | - | - | ㎡ | 2 | |
| 철 근 | ㎜ | - | ㎏ | - | |
| 볼 트 , 너 트 | ㎜ | - | 개 | - | |
| 꺽 쇠 | ㎜ | - | 개 | - | |
| 철 선 류 | ㎜ | 1 | ㎏ | 2 | |
| P C 강 선 | - | - | ㎏ | 2 | |
| 돌 망 태 | 길이m 지름m 높이m | 1 위 - - | m 개 | 1 - | 망눈(網目)㎝ |
| 로 프 류 | ㎜ | - | m | 1 | |
| 못 | 길이㎝ | 1 | ㎏ | 2 | |
| 석 유 , 휘 발 유 , 모 빌 유 | - | - | | 2 | |
| 구 리 스 | - | - | ㎏ | 2 | |
| 넝 마 | - | - | ㎏ | 2 | |
| 화 약 류 | - | - | ㎏ | 3 | |
| 뇌 관 | - | - | 개 | - | |
| 도 화 선 | - | - | m | 1 | |
| 석 탄 , 목 탄 , 코 크 스 | - | - | ㎏ | 1 | |
| 산 소 | - | - | | - | |
| 카 바 이 트 | - | - | ㎏ | 1 | |
"""
text = text[:m122.start()] + restored_122 + text[m122.end():]
print("Successfully restored 1-2-2 in merged file!")
else:
print("Could not match 1-2-2 pattern in merged file.")
# 3. Restore 1-2-7 in merged file
pattern_127 = re.compile(r'\|\s*주\s*철\s*관.*?\|\n', re.DOTALL)
m127 = pattern_127.search(text)
if m127:
print(f"Matched 1-2-7 in merged, len={len(m127.group(0))}")
restored_127 = """| 주 철 관 | ø80㎜∼150㎜ L=6.0m | 본 | 42111 | 46123 | - | - | |
| 〃 | 200450 〃 | 〃 | 930 | 1034 | - | - | |
| 〃 | 500600 〃 | 〃 | 6 | 69 | - | - | |
| 〃 | 700900 〃 | 〃 | 3 | 35 | - | - | |
| 〃 | 1,000〃 | 〃 | 2 | 2 | - | - | |
| 도복장강관 | ø300㎜∼450㎜ L=6.0m | 본 | 1018 | 1422 | - | - | |
| 〃 | 500700〃 | 〃 | 39 | 610 | - | - | |
| 〃 | 8001,000〃 | 〃 | 13 | 3 | - | - | |
| 〃 | 1,2002,100〃 | 〃 | 1 | 1 | - | - | |
| 〃 | 2,2002,300〃 | 〃 | - | 1 | - | - | |
| P ・C 파일 | ø300㎜∼440㎜ L=9.0m | 본 | - | - | 610 | 1118 | |
| 〃 | 450500 〃 | 〃 | - | - | 45 | 89 | |
| 시 멘 트 | 40㎏ | 대 | 150 | 200 | 275 | 637 | (25.5톤 화물차는 풀카고 기준) |
| 전 주 | 10m(일반용) | 본 | - | - | 12 | 23 | |
| 〃 | 체신주 8m | 〃 | - | 17 | 23 | 43 | |
"""
text = text[:m127.start()] + restored_127 + text[m127.end():]
print("Successfully restored 1-2-7 in merged file!")
else:
print("Could not match 1-2-7 in merged file.")
# 4. Restore 1-3-1 사석 in merged file
pattern_131 = re.compile(r'\|\s*기\s*초\s*사\s*석.*?\|\n', re.DOTALL)
m131 = pattern_131.search(text)
if m131:
print(f"Matched 1-3-1 in merged, 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% |
"""
text = text[:m131.start()] + restored_131 + text[m131.end():]
print("Successfully restored 1-3-1 in merged file!")
else:
print("Could not match 1-3-1 in merged file.")
with open(merged_file, 'w', encoding='utf-8') as f:
f.write(text)
print("Merged file sync write completed!")