SuperAPI AI 工具集

bib-search-citation

写作与研究

查看项目

更新于 10-16 05:01

技能介绍

用途:当用户提供 .bib 文件并希望做研究性检索(而非仅查单个引用 key)时使用。适合含标准字段与自定义字段(如 shorttitle、annotation、keywords、abstract、file)的大型文献库。

主要能力:把自然语言需求转换为 JSON 检索规格或紧凑查询表达式;用 scripts/search_bib.py 解析 .bib、过滤、排序并生成引用片段;可用 scripts/preview_bib_search.py 将 JSON 输出渲染为紧凑可读摘要。支持字段包括 query、年份上下限与包含/排除年份、作者包含/排除、类型包含/排除、has/exclude_has、字段包含/排除、sort、limit、return_fields、include_raw_bib、citation_mode。has 支持 doi、abstract、keywords、annotation、shorttitle、eprint、pdf、code,其中 code 由 url、abstract、keywords、annotation、note、howpublished 等字段中提及 GitHub、GitLab、code、repository 或 source 推断。

使用方式:先确定 .bib 文件;若可用 rtk,仅用其做探索性步骤,如 rtk find . -name "*.bib"、rtk read /path/to/library.bib -l aggressive -m 80、rtk grep "doi|keywords|annotation|eprint" /path/to/library.bib;机器可读结果仍走原始脚本。命令行示例:python scripts/search_bib.py --bib /path/to/library.bib --spec-json '{...}'、--query 'mamba time series forecasting author:Cheng year>=2024 has:code type:article,misc cite:both limit:5' 或 --spec-file /path/to/spec.json;预览可管道到 python scripts/preview_bib_search.py。紧凑查询支持 author:cheng、year>=2024、year:2023,2024、type:article,misc、-type:misc、has:code,doi、-has:pdf、annotation:CodeAvailable、keywords:mamba、sort:year_desc、limit:10、fields:key,title,year,doi、cite:latex/typst/both、raw:true。默认 sort 为 relevance、limit 为 5,默认返回 key、title、shorttitle、author、year、venue、doi、eprint、keywords、annotation、abstract。LaTeX 可输出 \cite{key}、\parencite{key}、\textcite{key};Typst 可输出 @key、#cite(<key>) 或 #cite(label("key")),当 typst.needs_label 为 true 时优先 label 形式。

限制:纯 Python 线性扫描、无外部依赖,约 1 万条以内数秒完成,5 万条以上耗时更长但功能正常;解析错误的条目会被静默跳过,文件整体解析失败需检查 UTF-8 编码与括号缺失;零结果时建议放宽 has 约束、年份或关键词并核对作者拼写。主题相关性仅近似时应说明。