citation-manager

citation-manager

APA 7th citation formatter with CrossRef DOI validation, preventing LLMs from hallucinating author names on papers they didn't write.
#البحث#التعليم#الإنتاجية
التقييم
مطلوب المزيد من التقييمات
المبيعات
0
كيفية الاستخدام
تنزيل

citation-manager

APA 7th citation formatter with CrossRef DOI validation — prevents LLMs from hallucinating author names on papers they didn't write.

python3 cite.py britton-2020              # → (Britton et al., 2020)
python3 cite.py britton-2020 --list       # → full reference entry
python3 cite.py --validate                # → check all DOIs against CrossRef
python3 cite.py --fix-dois                # → auto-correct hallucinated authors
python3 cite.py --fetch-doi 10.xxxx/xxxxx # → create entry from a DOI

The Problem

LLMs frequently write wrong author names in reference lists — including your own name on papers you didn't author. The references.yaml file looks plausible, but every author name could be hallucinated. This tool validates every reference with a DOI against the CrossRef API and auto-corrects mismatches.

Features

Command What it does
cite.py <id> In-text citation: (Smith et al., 2020)
cite.py <id> --list Full APA 7th reference-list entry
cite.py --all --list Complete numbered reference list with verification status
cite.py --validate Check all DOIs against CrossRef, report mismatches
cite.py --fix-dois Auto-correct author names/titles/years from CrossRef
cite.py --fetch-doi <doi> Create complete reference entry from a DOI
cite.py --diff <id> Side-by-side local vs CrossRef comparison
cite.py --search "keyword" Search titles, authors, DOIs
cite.py --export-bibtex Export all references as BibTeX
cite.py --render-pandoc Render via pandoc-citeproc (APA 7th)

Install

pip install pyyaml
# Optional: pandoc 3.x+ for --render-pandoc and --export-bibtex

Quick Start

# 1. Create references.yaml in your project directory
cp references.yaml /path/to/project/

# 2. After the LLM writes references, ALWAYS validate:
python3 cite.py --validate

# 3. Fix any mismatches automatically:
python3 cite.py --fix-dois

# 4. Get in-text citations and reference entries:
python3 cite.py smith-2024           # (Smith et al., 2024)
python3 cite.py smith-2024 --list    # Smith, J. A., Jones, B. C., & Lee, D. E. (2024). ...
python3 cite.py --all --list          # Full numbered reference list

# 5. Add a new reference from just a DOI:
python3 cite.py --fetch-doi 10.1038/nature12373

references.yaml Format

- id: smith-2024
  authors:
    - "Smith, J. A."
    - "Jones, B. C."
  year: 2024
  title: "Paper Title"
  journal: "Nature"
  volume: "600"
  pages: "1-10"
  doi: "10.1038/nature12373"
  url: "https://doi.org/10.1038/nature12373"
  verified: true
  type: journal

Required: id, authors, year, title
Recommended: doi (required for CrossRef validation), journal, volume, pages
Author format: "Last, F. M." — e.g., "Britton, J. R."

DOI Validation Workflow

LLM writes references.yaml
    ↓
python3 cite.py --validate     ← checks every DOI against CrossRef
    ↓
❌ 3 author mismatches found
    ↓
python3 cite.py --fix-dois     ← overwrites with verified CrossRef data
    ↓
✅ All references verified

Citation Rules (APA 7th)

Authors In-text Example
1 (Last, Year) (Correll, 1998)
2 (Last1 & Last2, Year) (Jamizan & Chong, 2017)
3–20 (Last et al., Year) (Britton et al., 2020)
21+ (Last et al., Year) Truncated in reference list

Requirements

  • Python 3.8+
  • PyYAML (pip install pyyaml)
  • pandoc 3.x+ (optional, for --render-pandoc)
  • Internet access (for CrossRef API validation)