34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
import os, sys, re, json
|
|
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
|
|
base_dir = 'resources/knowledge/original/원가계산/건설공사_표준품셈'
|
|
target_dirs = ['02_토목부문', '05_유지관리부문', '04_기계설비부문']
|
|
|
|
candidates = []
|
|
for td in target_dirs:
|
|
dirpath = os.path.join(base_dir, td)
|
|
for root, dirs, files in os.walk(dirpath):
|
|
for f in files:
|
|
if td == '04_기계설비부문' and '제13장' not in f:
|
|
continue
|
|
if f.endswith('.md') and not f.startswith('_') and '개정사항' not in f:
|
|
fpath = os.path.join(root, f)
|
|
with open(fpath, 'r', encoding='utf-8') as fp:
|
|
lines = fp.readlines()
|
|
for idx, line in enumerate(lines):
|
|
line_s = line.strip()
|
|
if not line_s.startswith('|') and len(line_s) > 25:
|
|
has_kw = (('구 분' in line_s or '구분' in line_s or '직 종' in line_s or '직종' in line_s) and
|
|
('단위' in line_s or '단 위' in line_s or '수량' in line_s or '수 량' in line_s or '인력품' in line_s))
|
|
if has_kw:
|
|
candidates.append({
|
|
'file': f,
|
|
'line': idx + 1,
|
|
'text': line_s
|
|
})
|
|
|
|
print(f"Total candidates: {len(candidates)}")
|
|
for c in candidates:
|
|
print(f"[{c['file']}] L{c['line']}: {c['text'][:110]}")
|