Skip to main content

HaRC - Hallucinated Reference Checker

PyPI version Python 3.10+ License: MIT

Verify BibTeX citations against academic databases. Catches fake, misspelled, or incorrect references in your .bib files before submission.

Features

Source Lookup Methods Entry Types
Semantic Scholar DOI, arXiv ID, title search Papers
DBLP Title search Papers
Google Scholar Title search Papers
Open Library ISBN, title search Books

Additional capabilities:

  • Fuzzy author matching - Handles name variations, initials, and spelling differences
  • URL verification - Checks reachability and title matching for web citations
  • Smart fallback - Tries multiple databases until a valid match is found

Installation

# Using uv (recommended)
uv add harcx

# Using pip
pip install harcx

Quick Start

# Basic usage
harcx references.bib

# Also verify URL citations
harcx references.bib --check-urls

# Quiet mode (errors only)
harcx references.bib -q

CLI Reference

harcx [OPTIONS] BIB_FILE

Options:
  -q, --quiet              Suppress progress output
  --threshold FLOAT        Author match threshold (0.0-1.0, default: 0.6)
  --api-key KEY            Semantic Scholar API key for higher rate limits
  --check-urls             Verify URL citations for reachability
  --title-threshold FLOAT  URL title match threshold (0.0-1.0, default: 0.6)
  -h, --help               Show help message

Example Output

Parsed 50 entries from references.bib
[1/50] Checking (article): smith2023
    Trying arXiv ID: 2301.12345
  Found (author match: 1.00)
[2/50] Checking (book): goodfellow2016deep
    Trying Open Library title search
  Found (author match: 0.75)
[3/50] Checking (article): suspicious2023
    Trying Semantic Scholar title search
    Trying DBLP title search
    Trying Google Scholar title search
  ISSUE: Not found in Semantic Scholar, DBLP, or Google Scholar

============================================================
Found 1 entries requiring attention:
============================================================

[suspicious2023]
  Title: This Paper Does Not Exist
  Bib Authors: Suspicious Author
  Year: 2023
  Issue: Not found in Semantic Scholar, DBLP, or Google Scholar

Python API

from reference_checker import check_citations, check_web_citations

# Check citations - returns entries that weren't verified
issues = check_citations("references.bib")

for result in issues:
    print(f"{result.entry.key}: {result.message}")

# Check URL citations
url_issues = check_web_citations("references.bib")

for result in url_issues:
    print(f"{result.entry.key}: {result.url} - {result.message}")

Function Signatures

def check_citations(
    bib_file: str,
    author_threshold: float = 0.6,  # Minimum author match score
    year_tolerance: int = 1,         # Allowed year difference (±)
    api_key: str | None = None,      # Semantic Scholar API key
    verbose: bool = False,           # Print progress
) -> list[CheckResult]

def check_web_citations(
    bib_file: str,
    title_threshold: float = 0.6,    # Minimum title match score
    verbose: bool = False,           # Print progress
) -> list[WebCheckResult]

How It Works

┌─────────────┐     ┌──────────────┐     ┌─────────────┐     ┌──────────┐
│  Parse .bib │ ──▶ │    Lookup    │ ──▶ │ Fuzzy Match │ ──▶ │  Report  │
│    file     │     │  (DOI/title) │     │   Authors   │     │  Issues  │
└─────────────┘     └──────────────┘     └─────────────┘     └──────────┘

Lookup Order (Papers):

  1. DOI lookup (Semantic Scholar)
  2. arXiv ID lookup (Semantic Scholar)
  3. Title search (Semantic Scholar → DBLP → Google Scholar)

Lookup Order (Books):

  1. ISBN lookup (Open Library)
  2. Title search (Open Library → Semantic Scholar → DBLP → Google Scholar)

A citation is verified when:

  • Found in at least one database
  • Author match score ≥ threshold (default: 60%)
  • Year matches within tolerance (default: ±1 year)

Rate Limits

  • Semantic Scholar: ~3 req/sec (faster with API key)
  • DBLP: ~1 req/sec
  • Google Scholar: ~0.5 req/sec (may block excessive requests)
  • Open Library: ~1 req/sec

Get a free Semantic Scholar API key at semanticscholar.org/product/api

Development

git clone https://github.com/gurusha01/HaRC.git
cd HaRC
uv sync --all-extras
uv run pytest tests/ -v

License

MIT

Metadata

Release files for harcx 0.2.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 harcx 0.2.0
File Size Uploaded
harcx-0.2.0.tar.gz 17.5 kB Details

Built distribution (wheel)

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

Total release size: 37.4 kB

Release files / harcx-0.2.0.tar.gz

Download URL harcx-0.2.0.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
373431700a68630cf3f56fba2354b3300f147ae64d3a3dee2faadc3026a2cb09
BLAKE2b-256 checksum
How to use checksums
c1b8bede401915b0ac1d1ab84292dd57555b53941895d4439f3f1f8324cba0b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / harcx-0.2.0-py3-none-any.whl

Download URL harcx-0.2.0-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
329ea9e42f653f876b4388c881b7209e4df666ca34b5d928fa987e4998857e80
BLAKE2b-256 checksum
How to use checksums
065b0bacc3d88b08027c6e10e5523e85d18bf6093aac58c013d4ccac9db41c4f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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