journal-abbrev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseJournal Abbreviation Lookup
—
Look up journal/magazine name abbreviations using a multi-source cascade: JabRef database (~25K journals) → AbbrevISO API (ISO 4) → NLM Catalog (MEDLINE).
Critical rule: Always use for lookups. Never guess abbreviations — even common journals have non-obvious abbreviations.
jabbrv.pyClaude Code 字段在上,OpenClaw/SkillsMP 字段在下 --- author: Agents365-ai category: Academic Research version: 1.3.0 created: 2026-03-29 updated: 2026-05-19 github: https://github.com/Agents365-ai/journal-abbrev homepage: https://github.com/Agents365-ai/journal-abbrev metadata: openclaw: requires: bins: - python3 emoji: "📖" homepage: https://github.com/Agents365-ai/journal-abbrev os: ["macos", "linux", "windows"]
Quick Reference
期刊缩写查询
| User wants... | Command |
|---|---|
| Abbreviate a journal name | |
| Expand an abbreviation | |
| Auto-detect direction | |
| Fuzzy search (paginated) | |
| Process a .bib file | |
| Preview .bib changes (no write) | |
| Explicit .bib output path | |
| Expand .bib abbreviations | |
| Replay-safe .bib (retry returns cached envelope) | |
| Batch text list | |
| Batch as NDJSON stream | |
| Inspect cache state | |
| Download missing cache files | |
| Preview what update would fetch | |
| Atomic rebuild (destructive, with audit marker) | |
| Preview rebuild (no delete) | |
| Suppress stderr progress | |
| Machine-readable CLI contract | |
| Schema for one subcommand | |
通过多源级联查询期刊/杂志名称缩写:JabRef 数据库(约25000种期刊)→ AbbrevISO API(ISO 4标准)→ NLM Catalog(MEDLINE标准)。
重要规则: 必须使用 进行查询。切勿自行猜测缩写——即使是常见期刊也可能有非直观的缩写。
jabbrv.pyOutput format
快速参考
Stdout is a stable JSON envelope when the CLI is not attached to a terminal
(piped or captured by an agent), and a human table/indented view when run on a
TTY. To force a format: . remains as a
back-compat alias for . Flags may appear before or after the
subcommand.
--format json|table|human|auto--json--format jsonEnvelope shape (always the same fields for every subcommand):
- Success:
{ "ok": true, "data": ..., "meta": { "schema_version", "cli_version", "cache", "latency_ms" } } - Partial success (batch):
{ "ok": "partial", "data": { "succeeded": [...], "failed": [...] }, "meta": {...} } - Error:
{ "ok": false, "error": { "code", "message", "retryable", ... }, "meta": {...} }
| 用户需求... | 命令 |
|---|---|
| 缩写期刊名称 | |
| 展开缩写 | |
| 自动检测转换方向 | |
| 模糊搜索(分页) | |
| 处理.bib文件 | |
| 预览.bib文件修改(不写入) | |
| 指定.bib输出路径 | |
| 展开.bib文件中的缩写 | |
| 可重放的.bib处理(重试返回缓存结果) | |
| 批量处理文本列表 | |
| 以NDJSON流形式批量处理 | |
| 查看缓存状态 | |
| 下载缺失的缓存文件 | |
| 预览缓存更新将获取的内容 | |
| 原子重建缓存(破坏性操作,带审计标记) | |
| 预览缓存重建(不删除现有缓存) | |
| 抑制stderr进度输出 | |
| 机器可读CLI契约 | |
| 单个子命令的Schema | |
Exit codes
输出格式
| Code | Meaning |
|---|---|
| success (including partial success) |
| runtime / upstream error |
| validation / bad input (missing file, bad flag) |
| not found (the looked-up journal does not exist) |
当CLI未连接到终端(通过管道传输或被Agent捕获)时,标准输出为稳定的JSON包;在TTY上运行时则显示人类可读的表格/缩进视图。可通过强制指定格式。作为的向后兼容别名仍然有效。参数可在子命令之前或之后出现。
--format json|table|human|auto--json--format json包结构(每个子命令的字段始终一致):
- 成功:
{ "ok": true, "data": ..., "meta": { "schema_version", "cli_version", "cache", "latency_ms" } } - 部分成功(批量处理):
{ "ok": "partial", "data": { "succeeded": [...], "failed": [...] }, "meta": {...} } - 错误:
{ "ok": false, "error": { "code", "message", "retryable", ... }, "meta": {...} }
Error codes (inside error.code
)
error.code退出码
| Code | Retryable | Exit | Meaning |
|---|---|---|---|
| no | 3 | Lookup completed but no source matched |
| yes | 1 | One or more upstream APIs failed transiently; the lookup could not be concluded. Carries |
| no | 2 | Input file path does not exist |
| no | 2 | Bad argument or flag combination |
| yes | 1 | Unexpected internal error |
Branch on + rather than exit code alone — exit
covers both and . Full machine-readable
listing: → .
error.codeerror.retryable1upstream_unavailableruntime_errorpython3 jabbrv.py schemadata.error_codes| 代码 | 含义 |
|---|---|
| 成功(包括部分成功) |
| 运行时/上游错误 |
| 验证/输入错误(文件缺失、参数错误) |
| 未找到(查询的期刊不存在) |
Environment variables (set by host, not by agent argv)
错误代码(位于error.code
中)
error.code| Variable | Effect |
|---|---|
| Override the cache directory (default: |
| Truthy ( |
| https://no-color.org convention. Any non-empty value disables color. No ANSI is emitted today; |
Trust boundary: these are read from the process environment, not from
arguments. The host or sandbox sets them; the agent cannot override them via
argv. Schema introspection: → .
python3 jabbrv.py schemadata.global_env| 代码 | 是否可重试 | 退出码 | 含义 |
|---|---|---|---|
| 否 | 3 | 查询完成但无匹配源 |
| 是 | 1 | 一个或多个上游API临时失败;查询无法完成。包含 |
| 否 | 2 | 输入文件路径不存在 |
| 否 | 2 | 参数或标志组合错误 |
| 是 | 1 | 意外的内部错误 |
应根据 + 进行分支判断,而非仅依赖退出码——退出码涵盖(可重试)和(重试一次后升级)。完整的机器可读列表: → 。
error.codeerror.retryable1upstream_unavailableruntime_errorpython3 jabbrv.py schemadata.error_codesRetries, idempotency, and destructive intent
环境变量(由主机设置,而非Agent的argv参数)
- Branch on +
error.code, not exit code alone. Exiterror.retryablecovers both1(retry) andupstream_unavailable(retry once, then escalate).runtime_error - persists the success envelope next to the output file as
bib --idempotency-key <token>. A retry with the same key returns that envelope with<output>.<token>.envelope.jsoninstead of rerunning the rewrite. Token must matchmeta.idempotent_replay: true.[A-Za-z0-9._-]{1,64} - is atomic — downloads stage into a sibling directory and the swap only happens if every file succeeded. If any fails, the existing cache is preserved and the response is
cache rebuild(retryable). Addupstream_unavailableto record--yesfor audit policies; the CLI itself never prompts, someta.confirmed: trueis not a gate.--yes
| 变量 | 作用 |
|---|---|
| 覆盖缓存目录(默认: |
| 真值( |
| 遵循https://no-color.org约定。任何非空值都会禁用颜色。目前不会输出ANSI代码;设置后包中会显示`meta.no_color: true`,以便调用方了解此策略。 |
信任边界:这些变量从进程环境读取,而非从参数读取。由主机或沙箱设置;Agent无法通过argv覆盖。Schema自省: → 。
python3 jabbrv.py schemadata.global_envWorkflow
重试、幂等性与破坏性操作
Step 1: Detect Intent
—
| Intent | Action |
|---|---|
| Single journal name/abbreviation | Use |
| "What's the abbreviation for X?" | Use |
| "What journal is X?" | Use |
| Partial or uncertain name | Use |
| Fix journal names in .bib file | Use |
| List of journals to process | Use |
- 根据+
error.code进行分支判断,而非仅依赖退出码。退出码error.retryable涵盖1(可重试)和upstream_unavailable(重试一次后升级)。runtime_error - 会将成功包持久化到输出文件旁边,命名为
bib --idempotency-key <token>。使用相同密钥重试时,会返回该包并标记<output>.<token>.envelope.json,而非重新执行重写操作。令牌必须匹配meta.idempotent_replay: true格式。[A-Za-z0-9._-]{1,64} - 是原子操作——下载的文件会先存储到同级目录,只有当所有文件下载成功时才会替换现有缓存。如果有任何失败,现有缓存会被保留,响应为
cache rebuild(可重试)。添加upstream_unavailable参数会在包中记录--yes以满足审计策略;CLI本身不会弹出提示,因此meta.confirmed: true并非必要的确认步骤。--yes
Step 2: Execute
工作流程
—
步骤1:识别意图
Run the appropriate command. The script handles:
jabbrv.py- Local cache lookup (instant, ~25K journals from JabRef)
- AbbrevISO API fallback (algorithmic ISO 4 abbreviation, forward only)
- NLM Catalog fallback (biomedical journals, bidirectional)
First run downloads JabRef CSV cache files automatically (~2-5 MB).
| 意图 | 操作 |
|---|---|
| 单个期刊名称/缩写转换 | 使用 |
| “X的缩写是什么?” | 使用 |
| “X是哪本期刊?” | 使用 |
| 名称不完整或不确定 | 使用 |
| 修复.bib文件中的期刊名称 | 使用 |
| 处理期刊列表 | 使用 |
Step 3: Present Results
步骤2:执行命令
- Show the full name, abbreviation, and source
- Note the standard (ISO 4 vs MEDLINE) when relevant
- For .bib processing: show the change summary before confirming
运行相应的命令。脚本会处理以下步骤:
jabbrv.py- 本地缓存查询(即时响应,来自JabRef的约25000种期刊)
- AbbrevISO API 回退(基于算法的ISO 4缩写,仅支持正向转换)
- NLM Catalog 回退(生物医学期刊,支持双向转换)
首次运行时会自动下载JabRef CSV缓存文件(约2-5 MB)。
ISO 4 vs MEDLINE
步骤3:展示结果
Two common abbreviation standards exist:
| Standard | Periods | Example | Used by |
|---|---|---|---|
| ISO 4 | Yes | Nat. Med. | Most publishers, BibTeX |
| MEDLINE | No | Nat Med | PubMed, NLM databases |
JabRef provides ISO 4 style. NLM Catalog provides MEDLINE style. AbbrevISO computes ISO 4 algorithmically from LTWA (List of Title Word Abbreviations).
- 显示全名、缩写及来源
- 必要时注明标准(ISO 4 vs MEDLINE)
- 处理.bib文件时:确认前先显示修改摘要
Common Abbreviation Patterns
ISO 4 vs MEDLINE
| Word | Abbreviation | Word | Abbreviation |
|---|---|---|---|
| Journal | J. | International | Int. |
| American | Am. | European | Eur. |
| Science/Sciences | Sci. | Medicine/Medical | Med. |
| Biology/Biological | Biol. | Chemistry/Chemical | Chem. |
| Physics/Physical | Phys. | Engineering | Eng. |
| Research | Res. | Review/Reviews | Rev. |
| Society | Soc. | National | Natl. |
| Proceedings | Proc. | Transactions | Trans. |
| Letters | Lett. | Communications | Commun. |
| Applied | Appl. | Computational | Comput. |
Note: Single-word titles (e.g., "Nature", "Science", "Cell") are NOT abbreviated per ISO 4 rules.
存在两种常见的缩写标准:
| 标准 | 是否带句点 | 示例 | 使用场景 |
|---|---|---|---|
| ISO 4 | 是 | Nat. Med. | 大多数出版商、BibTeX |
| MEDLINE | 否 | Nat Med | PubMed、NLM数据库 |
JabRef提供ISO 4格式。NLM Catalog提供MEDLINE格式。AbbrevISO基于LTWA(标题词缩写列表)通过算法计算ISO 4缩写。
Integration Examples
常见缩写模式
With Zotero
—
bash
undefined| 单词 | 缩写 | 单词 | 缩写 |
|---|---|---|---|
| Journal | J. | International | Int. |
| American | Am. | European | Eur. |
| Science/Sciences | Sci. | Medicine/Medical | Med. |
| Biology/Biological | Biol. | Chemistry/Chemical | Chem. |
| Physics/Physical | Phys. | Engineering | Eng. |
| Research | Res. | Review/Reviews | Rev. |
| Society | Soc. | National | Natl. |
| Proceedings | Proc. | Transactions | Trans. |
| Letters | Lett. | Communications | Commun. |
| Applied | Appl. | Computational | Comput. |
注意: 根据ISO 4规则,单字标题(如“Nature”“Science”“Cell”)不进行缩写。
Export BibTeX from Zotero, then standardize journal names
集成示例
—
与Zotero集成
zot export COLLECTION_KEY --format bibtex > refs.bib
python3 jabbrv.py bib refs.bib
undefinedbash
undefinedWith LaTeX
从Zotero导出BibTeX,然后标准化期刊名称
bash
undefinedzot export COLLECTION_KEY --format bibtex > refs.bib
python3 jabbrv.py bib refs.bib
undefinedBefore compiling, ensure all journal names are abbreviated
与LaTeX集成
python3 jabbrv.py bib references.bib
bash
undefinedUse the output file (references_abbrev.bib) in your LaTeX document
编译前,确保所有期刊名称已缩写
undefinedpython3 jabbrv.py bib references.bib
Batch Processing
在LaTeX文档中使用输出文件(references_abbrev.bib)
Create a text file with one journal name per line:
Nature Medicine
Journal of Biological Chemistry
Proceedings of the National Academy of SciencesThen run:
bash
python3 jabbrv.py batch journals.txtundefinedTroubleshooting
批量处理
| Issue | Solution |
|---|---|
| "No result found" | Try |
| Cache download fails | Check network connection, retry with |
| Wrong abbreviation style | JabRef = ISO 4 (with dots), NLM = MEDLINE (no dots) |
| BibTeX field not detected | Ensure format is |
创建一个文本文件,每行一个期刊名称:
Nature Medicine
Journal of Biological Chemistry
Proceedings of the National Academy of Sciences然后运行:
bash
python3 jabbrv.py batch journals.txt—
故障排除
—
| 问题 | 解决方案 |
|---|---|
| “未找到结果” | 使用 |
| 缓存下载失败 | 检查网络连接,使用 |
| 缩写格式错误 | JabRef = ISO 4(带句点),NLM = MEDLINE(无句点) |
| BibTeX字段未被检测到 | 确保格式为 |