Metadata-Version: 2.5
Name: check-hallucinations
Version: 0.20.0
Summary: Check BibTeX references for hallucinations before submitting a paper to arXiv
Project-URL: Homepage, https://github.com/ASSERT-KTH/check-hallucinations
Project-URL: Bug Tracker, https://github.com/ASSERT-KTH/check-hallucinations/issues
Author-email: Martin Monperrus <martin.monperrus@gmail.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Text Processing :: Markup :: LaTeX
Requires-Python: >=3.10
Requires-Dist: bibtexparser<3,>=2
Requires-Dist: keyring
Requires-Dist: requests
Provides-Extra: dev
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-cov; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: types-requests; extra == 'dev'
Description-Content-Type: text/markdown

# check-hallucinations

A command-line tool to detect hallucinated references in BibTeX files before submitting a paper to arXiv.

It checks each reference against [Semantic Scholar](https://www.semanticscholar.org/) and flags any title that cannot be found.

## Installation

```bash
pip install check-hallucinations
```

## Usage

```bash
check-hallucinations references.bib
```

Entries that cannot be found on Semantic Scholar are printed in red as potential hallucinations.

## How it works

For each entry in the BibTeX file, the tool queries Semantic Scholar by title. If no match is found, the entry is flagged as a likely hallucination (a reference invented by an LLM or a typo). `misc` entries without an `eprint` field are skipped unless they lack a `howpublished` URL.

## API key

By default the tool uses the public Semantic Scholar API (rate-limited). For higher throughput, set the `SEMANTICSCHOLAR_API_KEY` environment variable:

```bash
export SEMANTICSCHOLAR_API_KEY=your-key-here
check-hallucinations references.bib
```

## Development

```bash
uv venv && uv pip install -e '.[dev]'
.venv/bin/pytest && .venv/bin/ruff check . && .venv/bin/mypy check_hallucinations tests
```

## License

MIT
