mcpField
S
semantic-scholar

semantic-scholar

github.com/wanshuiyin生产力18.2k631 次安装4 天前更新
代码仓库

关于 semantic-scholar

semantic-scholar 是通过 Semantic Scholar 检索已发表期刊和会议论文的研究技能。它帮助研究者查看引用数、发表场所等信息,并区分正式发表的论文与 arXiv 预印本。

主要功能

  1. 01按主题或标识符检索论文
  2. 02按领域、类型、年份和引用数筛选
  3. 03查看发表场所与引用数信息
  4. 04通过 DOI 或 ID 获取论文详情
  5. 05在可用时显示 TLDR 和开放获取 PDF

适用场景

  1. 01查找研究领域的已发表论文
  2. 02根据 DOI 或标识符定位论文
  3. 03按引用数优先筛选论文
  4. 04确认论文是否也有 arXiv 版本

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/wanshuiyin/auto-claude-code-research-in-sleep --skill semantic-scholar

安装后在 Claude Code 中输入/semantic-scholar确认已加载。

详细介绍

Semantic Scholar 论文搜索

搜索主题或论文 ID:$ARGUMENTS

角色与定位

此技能是 /arxiv 的已发表论文对应技能:

技能来源适用场景
/arxivarXiv API最新预印本、前沿的未审稿研究
/semantic-scholarSemantic Scholar API已发表的期刊/会议论文(IEEE、ACM、Springer 等),包含引用次数、发表场所信息和 TLDR

不要重复 arXiv 的工作。 如果结果包含 externalIds.ArXiv 字段,则该论文也发布在 arXiv 上——请注明这一点,但不要重新从 arXiv 获取。

常量

  • MAX_RESULTS = 10 — 默认搜索结果数量。
  • S2_FETCHER — 标准名称为 semantic_scholar_fetch.py,根据 shared-references/integration-contract.md §2 解析(Policy D1 — 主路径 + 回退级联)。如果无法解析(标准名称解析链已耗尽),则回退到 Step 2 中记录的内嵌 Python 替代方案。
  • DEFAULT_FILTERS — 对于常规研究查询,默认应用以下筛选条件以减少噪声:
    • --fields-of-study "Computer Science,Engineering"
    • --publication-types JournalArticle,Conference

覆盖项(追加到参数中):

  • /semantic-scholar "topic" - max: 20 — 最多返回 20 条结果
  • /semantic-scholar "topic" - type: journal — 仅期刊论文
  • /semantic-scholar "topic" - type: conference — 仅会议论文
  • /semantic-scholar "topic" - min-citations: 50 — 仅高引用论文
  • /semantic-scholar "topic" - year: 2022- — 2022 年及之后的论文
  • /semantic-scholar "topic" - fields: all — 移除默认的研究领域筛选条件
  • /semantic-scholar "topic" - sort: citations — 按引用次数排序的批量搜索
  • /semantic-scholar "DOI:10.1109/..." — 按 DOI 获取单篇论文

工作流

Step 1:解析参数

解析 $ARGUMENTS 中的指令:

  • 查询词或 ID:主要搜索词,或论文标识符:
    • DOI:10.1109/TWC.2024.1234567
    • Semantic Scholar ID:f9314fd99be5f2b1b3efcfab87197d578160d553
    • ArXiv:ARXIV:2006.10685
    • Corpus:CorpusId:219792180
  • - max: N:覆盖 MAX_RESULTS
  • - type: journal|conference|review|all:映射到 --publication-types
  • - min-citations: N:映射到 --min-citations
  • - year: RANGE:映射到 --year(例如 2022-、2020-2024)
  • - fields: FIELDS:覆盖 --fields-of-study(使用 all 移除筛选条件)
  • - sort: citations|date:使用 search-bulk,并指定 --sort citationCount:desc 或 publicationDate:desc

如果参数符合 DOI 格式(10.XXXX/...)、Semantic Scholar ID(40 位十六进制数)或带前缀的 ID(ARXIV:...、CorpusId:...),则跳过搜索,直接进入 Step 3。

Step 2:搜索论文

通过标准严格安全链解析 $S2_FETCHER(参见 shared-references/integration-contract.md §2):

cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 1
if [ -z "${ARIS_REPO:-}" ] && [ -f .aris/installed-skills.txt ]; then
    ARIS_REPO=$(awk -F'\t' '$1=="repo_root"{print $2; exit}' .aris/installed-skills.txt 2>/dev/null) || true
fi
if [ -z "${ARIS_REPO:-}" ] && [ -f "$HOME/.aris/repo" ]; then
    ARIS_REPO=$(cat "$HOME/.aris/repo" 2>/dev/null) || true
fi
S2_FETCHER=".aris/tools/semantic_scholar_fetch.py"
[ -f "$S2_FETCHER" ] || S2_FETCHER="tools/semantic_scholar_fetch.py"
[ -f "$S2_FETCHER" ] || { [ -n "${ARIS_REPO:-}" ] && S2_FETCHER="$ARIS_REPO/tools/semantic_scholar_fetch.py"; }
[ -f "$S2_FETCHER" ] || S2_FETCHER=""

标准搜索(默认——按相关性排序):

python3 "$S2_FETCHER" search "QUERY" --max MAX_RESULTS \
  --fields-of-study "Computer Science,Engineering" \
  --publication-types JournalArticle,Conference

批量搜索(指定 - sort: 或 MAX_RESULTS > 100 时):

python3 "$S2_FETCHER" search-bulk "QUERY" --max MAX_RESULTS \
  --sort citationCount:desc \
  --fields-of-study "Computer Science" \
  --year "2020-"

如果 $S2_FETCHER 为空(Policy D1 级联),则回退到内嵌 Python,通过 urllib 调用 https://api.semanticscholar.org/graph/v1/paper/search。

推荐的筛选条件组合(经测试):

目标标记
高质量期刊论文--publication-types JournalArticle --min-citations 10
CS/EE 论文,近期发表--fields-of-study "Computer Science,Engineering" --year "2022-"
奠基性/高影响力论文search-bulk --sort citationCount:desc --fields-of-study "Computer Science"
仅会议论文--publication-types Conference

注意:--venue 要求使用准确的发表场所名称(例如 “IEEE Transactions on Signal Processing”),不能使用 “IEEE” 这类部分匹配项。避免在自动化流程中使用 --venue——优先使用 --publication-types 和 --fields-of-study。

第 3 步:获取特定论文的详细信息

请求单篇论文时:

python3 "$S2_FETCHER" paper "PAPER_ID"

PAPER_ID 可以是:

  • DOI:10.1109/TSP.2021.3071210
  • ArXiv:ARXIV:2006.10685
  • CorpusId:CorpusId:219792180
  • S2 ID:f9314fd99be5f2b1b3efcfab87197d578160d553
第 4 步:与 arXiv 去重

对于每条结果,检查 externalIds.ArXiv:

  • 如果存在 → 论文也发布在 arXiv 上。在输出中注明,但不要通过 /arxiv 重新获取。
  • 如果不存在 → 论文仅在出版渠道发表(例如没有预印本的 IEEE 论文)。这是此技能的独特价值。
第 5 步:展示结果

以表格形式展示结果:

| # | Title | Venue | Year | Citations | Authors | Type |
|---|-------|-------|------|-----------|---------|------|
| 1 | Deep Learning Enabled... | IEEE Trans. Signal Process. | 2021 | 1364 | Xie et al. | Journal |

对于每篇论文,还需显示:

  • DOI 链接:https://doi.org/DOI(对于 IEEE/ACM 论文,这是规范链接)
  • 开放获取 PDF:如果 openAccessPdf.url 非空,则显示
  • TLDR:如果可用,则显示单行摘要
  • 也发布在 arXiv 上:如果存在 externalIds.ArXiv,则注明 arXiv ID
第 6 步:详细摘要

对于每篇论文(如果结果很多,则取前 5 篇):

## [Title]

- **Venue**: [venue name] ([publicationVenue.type]: journal/conference)
- **Year**: [year] | **Citations**: [citationCount]
- **Authors**: [full author list]
- **DOI**: [doi link]
- **Fields**: [fieldsOfStudy]
- **TLDR**: [tldr.text if available]
- **Abstract**: [abstract]
- **Open Access**: [openAccessPdf.url or "Not available"]
- **Also on arXiv**: [ArXiv ID if exists, else "No"]
第 7 步:更新研究 Wiki(如果已启用)

如果项目中存在 research-wiki/,则必须执行;否则静默跳过。当 Wiki 目录存在时,按照规范链解析 $WIKI_SCRIPT: shared-references/wiki-helper-resolution.md (变体 B——警告并跳过)。对于包含 externalIds.ArXiv 字段的结果,使用 --arxiv-id;对于仅在出版渠道发表的论文(没有 arXiv 镜像, IEEE/ACM 论文中很常见),则回退到手动元数据:

if [ -d research-wiki/ ]; then
  cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)" || exit 1
  ARIS_REPO="${ARIS_REPO:-$(awk -F'\t' '$1=="repo_root"{print $2; exit}' .aris/installed-skills.txt 2>/dev/null)}"
  if [ -z "${ARIS_REPO:-}" ] && [ -f "$HOME/.aris/repo" ]; then
    ARIS_REPO=$(cat "$HOME/.aris/repo" 2>/dev/null) || true
  fi
  WIKI_SCRIPT=".aris/tools/research_wiki.py"
  [ -f "$WIKI_SCRIPT" ] || WIKI_SCRIPT="tools/research_wiki.py"
  [ -f "$WIKI_SCRIPT" ] || { [ -n "${ARIS_REPO:-}" ] && WIKI_SCRIPT="$ARIS_REPO/tools/research_wiki.py"; }
  [ -f "$WIKI_SCRIPT" ] || {
    echo "WARN: research_wiki.py not found; semantic-scholar results delivered, wiki ingest skipped. Fix: bash tools/install_aris.sh or smart_update.sh (refreshes ~/.aris/repo), export ARIS_REPO, or cp <ARIS-repo>/tools/research_wiki.py tools/." >&2
    WIKI_SCRIPT=""
  }
  [ -n "$WIKI_SCRIPT" ] && for each paper in results:
        if paper.externalIds.ArXiv:
            python3 "$WIKI_SCRIPT" ingest_paper research-wiki/ \
                --arxiv-id "<ArXiv>"
        else:
            python3 "$WIKI_SCRIPT" ingest_paper research-wiki/ \
                --title "<title>" --authors "<authors joined by , >" \
                --year <year> --venue "<venue>" \
                [--external-id-doi "<externalIds.DOI>"]
fi

此辅助程序会处理 slug、去重、页面、索引和日志——不要手动编写 papers/<slug>.md。参阅 shared-references/integration-contract.md。 对于可在 arXiv 上获取的论文,使用 /research-wiki sync --arxiv-ids <id1>,<id2>,... 补录。

第 8 步:最终输出

总结已完成的工作:

  • Found N published papers for "query"
  • Filters applied: [publication types, fields, year range, etc.]
  • N papers are venue-only (not on arXiv)
  • Wiki-ingested N papers(如果存在 research-wiki/)

建议后续技能:

/arxiv "topic"           - search arXiv preprints (complements this search)
/research-lit "topic"    - multi-source review: Zotero + local PDFs + arXiv + S2
/novelty-check "idea"    - verify novelty against literature

关键规则

  • 默认使用筛选搜索:除非用户指定 - fields: all,否则始终应用 --fields-of-study 和 --publication-types。如果不使用筛选条件,S2 会返回跨学科噪声(语言学、心理学等)。
  • 引用次数至关重要:引用数据是 S2 相较于 arXiv 的主要优势。始终醒目地显示 citationCount,并用它对结果排序或确定优先级。
  • 出版渠道元数据很重要:显示 venue 和 publicationVenue.type(期刊或会议),帮助用户评估论文质量。
  • DOI 是已发表论文的规范 ID:始终显示 IEEE/ACM/Springer 论文的 DOI 链接。
  • 速率限制:未配置密钥的 S2 API 受到严格的速率限制(约 1 次请求/秒,冷却限制严格)。如果出现 HTTP 429,请等待后重试。建议用户设置 SEMANTIC_SCHOLAR_API_KEY 环境变量以提高限额(可在 https://www.semanticscholar.org/product/api#api-key-form 免费获取)。
  • TLDR 可能为 null:部分出版商(尤其是 IEEE)会省略 TLDR 字段。此时改为显示摘要的第一句话。
  • openAccessPdf 可能为空:许多 IEEE 论文为非开放获取。始终提供 DOI 链接作为备用。
  • 如果无法访问 S2 API,建议改用 /arxiv 或 /research-lit "topic" - sources: web。

评论

支持 Markdown