Skip to main content

citeguard

学術参考文献を Crossref・PubMed・arXiv・JaLC で照合し、未発見・撤回だけでなく、誤引用の可能性が高い書誌も拾い上げる reference checker です。CLI に加えて、Vercel に配置できる Web UI / API を含みます。DOI が Crossref 以外の登録機関に属する場合も自動でフォールバック解決します。

pip install citeguard

できること

  • 1行1書誌のテキスト、または BibTeX をそのまま入力できる
  • DOI、Crossref 書誌検索、PubMed、arXiv、JaLC を横断して候補を集める
  • 厳格一致した書誌は found、怪しい一致は likely_wrong、見つからない書誌は not_found として分類する
  • Crossref の更新通知から retraction / withdrawal / removal / partial_retraction を検出する
  • URL主体のウェブサイト参照やソフトウェア参照は website として学術DB検索をスキップする
  • Markdown レポートを stdout またはファイルに出力できる

インストール

PyPI

pip install citeguard

開発用セットアップ

git clone https://github.com/SRWS-PSG/citation-checker.git
cd citation-checker
python -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env

.env では CONTACT_EMAIL を設定できます。CLI では --email、Web API ではリクエストごとの email でも指定できます。

クイックスタート

# テキストファイルを検証
citeguard --input-file input/references.txt

# レポートを保存
citeguard --input-file input/references.txt --out outputs/report.md

# BibTeX もそのまま渡せる
citeguard --input-file input/test_sample.bib

# インラインテキスト
citeguard --text "Smith J. 2019. Some Title. J Example. DOI: 10.1234/abcd"

# stdin
cat input/references.txt | citeguard

# python -m でも実行可能
python -m refaudit --input-file input/references.txt

判定ステータス

  • found: 十分な一致があり、通常の照合結果として採用された
  • likely_wrong: 近い候補は見つかったが、タイトル・著者・掲載誌・ページなどにズレがあり、誤引用の可能性が高い
  • not_found: 候補が見つからない、または DOI を解決できない
  • website: ウェブサイト/ソフトウェア参照と判定され、学術DB検索を行わない

likely_wrong はこのブランチで強化した中心機能です。単なる no_match ではなく、最有力候補、DOI、項目ごとの差分、修正候補を返します。

CLI

主なオプション

オプション 説明
--input-file PATH 参考文献ファイル。プレーンテキストまたは BibTeX を自動判別
--text TEXT インライン参考文献テキスト
--out PATH Markdown レポート出力先。省略時は stdout
--all 正常な書誌も含めた全件レポートを出力
--debug 候補不採用時の候補情報を多めに出す
--email EMAIL Crossref / PubMed 向けの連絡先メールアドレス
--pdf / --no-pdf 行番号付きPDFテキストのクリーニングを強制適用 / 自動検出を無効化
--show-clean 再構成した参考文献リストを stdout に出力して終了(API照合なし)
--version バージョン表示

入力は --text と --input-file が排他です。どちらも指定しない場合は stdin を読みます。

入力形式

プレーンテキスト

  • 1行 = 1書誌
  • 行頭の [1]、1.、1) などは自動で除去
  • DOI を含む場合は DOI 解決を優先
  • arXiv:2307.06464 や 2307.06464 のような arXiv ID も抽出
  • 日本語文献や ・ 区切り著者にも対応
  • URL主体の行やソフトウェア参照は website としてスキップ

BibTeX

  • @article、@book、@inproceedings など主要エントリを自動検出
  • author、title、year、doi、eprint を使って照合
  • 特別なフラグは不要

行番号付きPDFテキスト

査読原稿などの PDF からコピペした、余白の行番号・ページフッターが紛れ込んだテキストにも対応します。

  • ページフッター(Page 18 of 44)、単語に癒着した行番号(Eur J for Pers2 Cent)を除去
  • ハイフンで行分割された語・URL を結合(person-5 centred-care → person-centred-care)
  • 文献番号(28. 29. …)の連番で個々の書誌に再分割
  • フッター+行番号列を検出して自動適用。--pdf で強制、--no-pdf で無効化
  • 誤クリーニング対策として、照合前に --show-clean で再構成結果を目視確認できる
# まず整形結果を確認
citeguard --input-file manuscript_refs.txt --show-clean
# 問題なければそのまま照合
citeguard --input-file manuscript_refs.txt --out outputs/report.md
citeguard --input-file references.bib

検索と判定の流れ

  1. DOI があれば Multi-RA で解決する
  2. arXiv ID があれば arXiv API を確認する
  3. Crossref query.bibliographic で候補を集める
  4. PubMed で全文引用・タイトル検索を行う
  5. 和文タイトルなら JaLC を検索する
  6. arXiv タイトル/著者検索も候補源として使う
  7. 候補を共通スコアリングで評価する

判定は2段階です。

  • verification: タイトル・著者・年・掲載先・巻号ページの一致を厳しめに判定し、found を決める
  • correction: found に届かなかった候補を再評価し、誤引用らしいものを likely_wrong として返す

このため、以前は no_match に落ちていたケースでも、近い候補があれば修正候補付きで報告されます。

撤回判定

  • DOI が得られた場合、Crossref filter=updates:{DOI},is-update:true で更新通知を取得します
  • update-to[].type が retraction / withdrawal / removal / partial_retraction なら撤回系として扱います
  • update-to[].source には publisher や retraction-watch が入ることがあります
  • レポートでは 種別、通知DOI、source、date を通知ごとに表示します

出力

通常出力は「問題があった書誌だけ」です。--all を付けると正常な書誌も含めたフルレポートになります。

出力される主なセクション

  • Likely Wrong Citation
  • 未発見
  • 撤回・撤回相当(Crossref 更新通知)
  • 出版年注意
  • ウェブサイト/ソフトウェア参照(--all 時)

出力例

# Reference Audit Report

対象:貼り付けテキストのうち **問題があった書誌**(未発見/誤引用候補/撤回系)だけを列挙しています。

## ⚠️ Likely Wrong Citation

- 入力: `Barteit S, Kyaw BM, Muller A, et al. The Effectiveness of Digital Game-Based Learning ... JMIR Serious Games 2021; 9(3): e29080.`
- 最有力候補: **Augmented, mixed, and virtual reality-based head-mounted devices for medical education: systematic review**
- DOI: `10.2196/29080`
- ⚠ 要確認 (1件):
  - 📄 タイトル: "The Effectiveness of Digital Game-Based Learning ..." → Crossref では "Augmented, mixed, and virtual reality-based head-mounted devices for medical education: systematic review"
- ✓ 一致 (4件): 👤 著者, 📅 出版年, 📚 掲載先, 📖 巻号・ページ
- 注記: candidate_mismatch

### 修正候補

- **Augmented, mixed, and virtual reality-based head-mounted devices for medical education: systematic review**
- DOI: `10.2196/29080`
- 比較: title ~ / authors ok / year ok / venue ok / pages ok
- 書誌: JMIR Serious Games / 2021

## 🚩 撤回・撤回相当(Crossref 更新通知)

- 入力: `Doe A. 2011. Another title... Journal... DOI: 10.1234/abcd.5678`
- マッチ: **Another title...**
- DOI: `10.1234/abcd.5678`

### 参照された更新(通知)

- 種別: **retraction**, 通知DOI: `10.9999/notice.2020.1`, source: `retraction-watch`, date: `2020-05-01T00:00:00Z`

撤回系の表示では、入力書誌だけでなく、マッチした論文タイトルと DOI を出したうえで、Crossref の更新通知を一覧表示します。

Web UI / API

public/ に静的フロントエンド、api/ に Vercel Python Serverless Function(clean.py / check.py)を含みます。ブラウザ上は CLI と同じ「整形 → 人による確認・修正 → API照合」の3段フローです。

  1. ① 整形: 左の入力欄に参考文献テキストを貼り付けて「整形」を押すと、POST /api/clean が CLI と同じ split_references()(行番号付きPDFのクリーニング・BibTeX 自動検出を含む)で 1行=1件 に再構成します。このステップは外部APIへの問い合わせもメールアドレスも不要です。
  2. ② 確認・修正: 整形結果が右の編集欄に表示されます。左の原文と見比べ、文献の区切り(改行)や内容を人の目で確認・修正します。
  3. ③ チェック: 「チェック開始」で、編集欄の各行を POST /api/check に1件ずつ照合します。

Web でのメールアドレスの扱い

  • 整形(/api/clean)はメールアドレス不要です。チェック(/api/check)実行時のみ必須です
  • 用途は Crossref / PubMed の etiquette 用 User-Agent / email パラメータのみです
  • サーバー側では保存しません
  • ブラウザにも既定では保存しません
  • このブラウザにメールアドレスを保存 を有効にした場合のみ localStorage に保存します

API リクエスト仕様

POST /api/clean(整形・再構成。外部API呼び出しなし)

{
  "text": "pasted reference text"
}
  • text は必須、50000文字以内
  • 応答は {"ok": true, "refs": ["...", "..."]} 形式で、refs は再構成された1件1要素のリストです

POST /api/check(照合)

{
  "ref": "reference text",
  "email": "you@example.com"
}
  • ref は必須、2000文字以内
  • email は必須、形式チェックあり
  • 応答は {"ok": true, "result": ...} 形式で、result は MatchResult 相当の JSON を返します

Vercel デプロイ

公開インスタンス: https://citation-checker-three.vercel.app

npm install -g vercel
vercel
vercel --prod

Framework Preset は Other を使い、vercel.json をそのまま利用します。ローカル確認は vercel dev です。

API 利用時の作法

Crossref

  • User-Agent に mailto 付き識別子を設定
  • レート目安は 50 req/s。既定では礼儀的に待機を入れる
  • select= を使って返却項目を絞る

PubMed

  • tool / email を付与
  • タイトル検索と citation matcher を候補源として使う

arXiv

  • export.arxiv.org/api/query を使う
  • 直接ID照合を優先し、必要に応じてタイトル/著者検索も行う

Multi-RA DOI 解決

  • doira.org で Registration Agency を判定
  • Crossref / DataCite / JaLC / doi.org content negotiation を切り替える

GitHub Actions

ci.yml

  • ruff check .
  • テスト実行

run-pipeline.yml

  1. Secrets に CONTACT_EMAIL を設定
  2. input/references.txt を更新して push するか、手動実行する
  3. outputs/report.md を生成してコミットする

publish.yml

  • v* タグ push で配布フローを実行

開発

pip install -e ".[dev]"
pytest
ruff check .

誤引用検出まわりの回帰テストは tests/test_miscitation_detection.py にあります。

資金源

本プロジェクトは JSPS 科研費 JP25K13585(基盤研究(C)「大規模言語モデルが加速するエビデンスの統合」、研究代表者:片岡 裕貴、2025〜2027年度)の助成を受けています。


このリポジトリは AGENTS.md の設計方針に沿って実装されています。

Metadata

Release files for citeguard 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for citeguard 0.3.0
File Size Uploaded Provenance Actions
citeguard-0.3.0.tar.gz 59.1 kB With provenance Details for citeguard-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for citeguard 0.3.0
File Interpreter ABI Platform Actions
citeguard-0.3.0-py3-none-any.whl Python 3 none any Details for citeguard-0.3.0-py3-none-any.whl

Total release size: 107.2 kB

Release files / citeguard-0.3.0.tar.gz

Download URL citeguard-0.3.0.tar.gz
Size 59.1 kB
Tags Source
SHA-256 checksum
How to use checksums
89725359341904110fea826ab7ed6d68cab0d2baf3ac09d0dc63e2d3b7f7b85a
BLAKE2b-256 checksum
How to use checksums
40f1ef514ea7ba84db7f4af516b12ceb3e773d782a45f086c0a8efe3bb0299a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Release files / citeguard-0.3.0-py3-none-any.whl

Download URL citeguard-0.3.0-py3-none-any.whl
Size 48.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee1ee81955b2f5b0889a8e17861af99f1bdc7145252bd4ca3128874dd4b943bf
BLAKE2b-256 checksum
How to use checksums
6255f1b426d95b2d67e939c2df1cd6c76b9b3b00b8305b8c379edbe24af528c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

Security for citeguard 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for citeguard-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page