extract
它能做什么
这项技能对文件或一段文本运行完整的抽取流程,找出命名实体、关系、事件以及简单的主谓宾事实。适合想从文字材料中获得结构化事实的人。
适用场景
- ✓当你有一份文档,并想把其中的名称、关系和事件列成表格的时候。
- ✓当你希望在提取事实之前先解析代词和别名的时候。
- ✓当你想检查提取结果是否存在质量警告的时候。
技能链接
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/extract/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我从这份合同文件中提取关键人物、公司和重要事件,并列出任何质量警告?”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取文本,找出实体和关系,判断代词指代的对象,构建主谓宾事实,并运行验证检查。结果会以表格形式返回,任何警告都会一并显示。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/semantica:extract
Run the full extraction pipeline. Usage: /semantica:extract [file_path | "inline text"]
$ARGUMENTS = file path, inline text in quotes, or blank (uses active editor file).
Steps
1. Resolve the source.
- If
$ARGUMENTSis a readable file path →text = open(path).read() - If it's quoted inline text → use directly
- If blank → use the active editor file
2. Clear the result cache to prevent cross-invocation pollution:
from semantica.semantic_extract.cache import extraction_cache
extraction_cache.clear()
3. Run the full pipeline:
from semantica.semantic_extract import (
NamedEntityRecognizer,
RelationExtractor,
EventDetector,
CoreferenceResolver,
TripletExtractor,
ExtractionValidator,
)
# Named Entity Recognition
ner = NamedEntityRecognizer()
entities = ner.extract(text)
# Relation Extraction
rel = RelationExtractor()
relations = rel.extract(text)
# Event Detection
evt = EventDetector()
events = evt.extract(text)
# Coreference Resolution — resolve pronouns/aliases before extraction
coref = CoreferenceResolver()
resolved_text = coref.resolve(text)
# Triplet Extraction (subject–predicate–object)
triplet = TripletExtractor()
triplets = triplet.extract(resolved_text)
# Validate quality
validator = ExtractionValidator()
issues = validator.validate(entities, relations)
4. Report validator warnings above results:
⚠ ExtractionValidator: <warning message>
5. Return results as Markdown tables:
Entities (N total)
| Label | Type | Confidence | Span |
|---|
Relations (M total)
| Source | Relation Type | Target | Confidence |
|---|
Events (K total)
| Label | Type | Participants | Confidence |
|---|
Triplets (J total)
| Subject | Predicate | Object | Confidence |
|---|
6. Summary line:
Extracted: N entities, M relations, K events, J triplets — from <source>
For large files (>50KB), process in chunks and show a progress indicator. Highlight any entities appearing in the context graph already (ContextGraph.has_node(label)) with [in graph] tag.
常见问题
什么是指代消解?
就是判断“她”或“该公司”等词指的是哪个对象,使事实与正确的对象相连。
会返回哪些结果?
实体、关系、事件和三元组的表格,以及验证器给出的任何警告。
能对我正在编辑的文件运行吗?
能。如果没有指定文件,它可以使用编辑器中打开的文件。
详情
作者的原始描述
Run the full Semantica semantic extraction pipeline on a file or selected text — NER, relations, events, coreference resolution, triplets, and validation. Clears result cache before each run. Returns Markdown tables with entity/relation/event/triplet results and inline validator warnings.
repo: semantica-agi/semantica
热度
- GitHub 星标
- 14k
- 排名
- #11149
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …