FootnotesExtractor

Citation indexes read reference lists. Books cite in footnotes.

FootnotesExtractor reads the footnotes of a scholarly book, born-digital or scanned, finds every reference in them, tags its parts and hands them to you as data you can count, link and export. It runs on your own server.

A reference, tagged

1 M. de Wulf, Histoire de la philosophie médiévale, Louvain — Paris 1934, t. I, s. 166—170.1

Author
M. de Wulf: first name M., last name de Wulf
Title
Histoire de la philosophie médiévale
Place
Louvain — Paris
Year
1934
Volume
I
Pages
166—170

An ibid., resolved

76 Ibid., pp. 2-5.2

Refers to
footnote 75, on page 3
Author
Drexl taken from footnote 75
Title
Achmets Traumbuch taken from footnote 75
Pages
2-5

How you use it

1. Upload

Drop one or more PDFs on the start page, born-digital or scanned, up to 900 MB each. When processing ends, the book opens in the viewer with every footnote boxed, read and tagged.

Recording: a PDF is uploaded, processed, and opens in the viewer with its footnotes boxed and their references tagged.
A complete 88-page book. The wait is shortened here; the real run took about 3 minutes.1

2. Correct what is wrong

Press B and draw a box around a footnote the detector missed: about a second and a half later it is read and tagged. Click a box to change it, use the pencil to fix a footnote's text, split or merge footnotes, relabel any part, and undo any of it.

Switch on Layout Assist for suggestions. It learns each book's layout and citation style and points out what may be wrong. You decide what changes.

Recording: the reviewer draws a box around a footnote, and it is read and tagged.
Real time, nothing cut.1

3. Check back-references

Each ibid. and op. cit. shows the work it refers to. When a rule picks the wrong one, point it to the right one: it takes over that work's author, title and year, and the whole book is resolved again.

Recording: an Ibid. is linked to another earlier reference and takes over its author, journal, year and title.
The Ibid. is pointed to another work; its parts follow.2

4. Export

Use the Export Citations button: BibTeX, APA, Chicago, MLA, the references as printed, or JSON and CSV with everything. Each cited work appears once, with every place it is cited: PDF page, footnote number and the reference as printed.

Recording: a book is exported as BibTeX, and the file lists each work with every place it is cited.
Expanded BibTeX: ibid. and op. cit. count for the work they refer to.1

An administrator switches optional tools on per user in Admin → Users, such as linking references to a reference list given as BibTeX.

How it works

  1. Find footnotesA detector finds the footnote areas on each page image.
  2. Read themText comes from the PDF's text layer or, for scans, from OCR.
  3. Split themRules follow the footnote numbers, cut each area into single footnotes and rejoin notes that run over a page.
  4. Parse referencesTransformer models find each reference and tag its parts, down to first and last names.
  5. ResolveRules link ibid. and op. cit. to the work they refer to, each type by its own rule.

Install

Minimum requirements:

With OCR (scans too)
GPU memory10 GB
CPU4 cores
RAM12 GB
Disk6 GB
Speed, few footnotes0.3 s per page

You need Linux, Python 3.10 and an NVIDIA GPU with drivers for CUDA 12.4.

git clone https://github.com/FootnotesExtractor/FootnotesExtractor.git
cd FootnotesExtractor

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

python setup_models.py              # about 4 GB
FOOTNOTES_INSECURE_COOKIES=1 python wsgi.py --host 127.0.0.1     # http://127.0.0.1:5002

Surya downloads its own OCR weights (about 2.4 GB) the first time it runs. FOOTNOTES_INSECURE_COOKIES=1 lets you log in over plain HTTP on your own machine; never set it on a server, where you should use HTTPS instead. The first account you register becomes the administrator, who creates all further accounts in Admin → Users. For a server, see the deployment notes.

Use it over HTTP

Everything the browser does is also available as an API. Create a key on your Profile page, then:

import time
import requests

BASE = "http://127.0.0.1:5002"
HEADERS = {"X-API-Key": "fnk_..."}

with open("book.pdf", "rb") as f:
    job = requests.post(f"{BASE}/api/v1/documents", headers=HEADERS,
                        files={"file": ("book.pdf", f, "application/pdf")}).json()["job_id"]

def status():
    return requests.get(f"{BASE}/api/v1/documents/{job}", headers=HEADERS).json()["status"]

while status() not in ("completed", "error"):
    time.sleep(5)

bib = requests.get(f"{BASE}/download/{job}", headers=HEADERS, params={"format": "bibtex_expanded"})
with open("book.bib", "wb") as f:
    f.write(bib.content)

The API reference covers editing, groups, collections and the other export formats.

  1. M. Gogacz, Problem istnienia Boga u Anzelma z Canterbury i problem prawdy u Henryka z Gandawy, Katolicki Uniwersytet Lubelski, 1961 (CC BY-SA).
  2. Maria V. Mavroudi, A Byzantine Book on Dream Interpretation, Brill, 2002, doi:10.1163/9789004473461 (CC BY).