0441f6e2a2
- Formalized automatic record migration protocol in System Manual. - Integrated high-density knowledge for RAG, AI, Business Strategy, and Leadership. - Enhanced graph connectivity across core strategic hubs. - Archived raw data and updated timeline records.
78 lines
2.8 KiB
Python
78 lines
2.8 KiB
Python
import os
|
|
import re
|
|
from collections import Counter, defaultdict
|
|
|
|
wiki_root = "/Volumes/Data/project/Antigravity/Wiki/10_Wiki/Topics"
|
|
|
|
total_files = 0
|
|
total_links = 0
|
|
files_with_links = 0
|
|
link_destinations = Counter()
|
|
orphan_candidates = []
|
|
|
|
# Actionability indicators
|
|
actionable_headers = [
|
|
r'Trade-offs', r'Practical Application', r'Implementation',
|
|
r'Architecture Decision', r'실전 패턴', r'How-to', r'Code'
|
|
]
|
|
files_with_actionability = 0
|
|
total_code_blocks = 0
|
|
files_with_code = 0
|
|
|
|
p_reinforce_headers = 0
|
|
|
|
for root, dirs, files in os.walk(wiki_root):
|
|
for f in files:
|
|
if f.endswith('.md'):
|
|
total_files += 1
|
|
path = os.path.join(root, f)
|
|
try:
|
|
with open(path, 'r', encoding='utf-8') as file:
|
|
content = file.read()
|
|
except:
|
|
continue
|
|
|
|
# Link analysis
|
|
links = re.findall(r'\[\[(.*?)\]\]', content)
|
|
if links:
|
|
files_with_links += 1
|
|
total_links += len(links)
|
|
for link in links:
|
|
# Clean link (remove alias if exists)
|
|
dest = link.split('|')[0]
|
|
link_destinations[dest] += 1
|
|
else:
|
|
orphan_candidates.append(f)
|
|
|
|
# Actionability analysis
|
|
has_actionable = False
|
|
for header in actionable_headers:
|
|
if re.search(header, content, re.IGNORECASE):
|
|
has_actionable = True
|
|
break
|
|
if has_actionable:
|
|
files_with_actionability += 1
|
|
|
|
code_blocks = content.count('```') // 2
|
|
if code_blocks > 0:
|
|
total_code_blocks += code_blocks
|
|
files_with_code += 1
|
|
|
|
# P-Reinforce adherence
|
|
if 'Brief Summary' in content or '구조화된 지식' in content or 'Knowledge Connections' in content:
|
|
p_reinforce_headers += 1
|
|
|
|
print(f"--- INTERCONNECTIVITY ---")
|
|
print(f"Total Files: {total_files}")
|
|
print(f"Total Links: {total_links} (Avg {total_links/total_files:.2f} per file)")
|
|
print(f"Files with at least one link: {files_with_links} ({(files_with_links/total_files)*100:.1f}%)")
|
|
print(f"Orphan files (no outbound links): {len(orphan_candidates)}")
|
|
print(f"Top 5 Linked Concepts: {link_destinations.most_common(5)}")
|
|
|
|
print(f"\n--- ACTIONABILITY ---")
|
|
print(f"Files with Actionable Headers (Trade-offs, Implementation, etc.): {files_with_actionability} ({(files_with_actionability/total_files)*100:.1f}%)")
|
|
print(f"Files with Code Blocks: {files_with_code} ({(files_with_code/total_files)*100:.1f}%)")
|
|
print(f"Total Code Blocks: {total_code_blocks}")
|
|
print(f"Files adhering to P-Reinforce Structure: {p_reinforce_headers} ({(p_reinforce_headers/total_files)*100:.1f}%)")
|
|
|