MCPcopy
hub / github.com/alchaincyf/nuwa-skill / extract_key_findings

Function extract_key_findings

scripts/merge_research.py:47–61  ·  view source on GitHub ↗

提取关键发现(取前几个二级标题或加粗项)

(content: str, max_items: int = 3)

Source from the content-addressed store, hash-verified

45
46
47def extract_key_findings(content: str, max_items: int = 3) -> list[str]:
48 """提取关键发现(取前几个二级标题或加粗项)"""
49 # 尝试提取##标题
50 headings = re.findall(r'^##\s+(.+)$', content, re.MULTILINE)
51 if headings:
52 return headings[:max_items]
53
54 # fallback: 提取加粗项
55 bolds = re.findall(r'\*\*(.+?)\*\*', content)
56 if bolds:
57 return bolds[:max_items]
58
59 # fallback: 取前3个非空行
60 lines = [l.strip() for l in content.split('\n') if l.strip() and not l.startswith('#')]
61 return [l[:50] + '...' if len(l) > 50 else l for l in lines[:max_items]]
62
63
64def find_contradictions(files: dict[str, str]) -> list[str]:

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected