Skip to main content

Scripts to enhance Philosophie.ch's Bibliography

Project description

Philosophie.ch Bibliography enhancer scripts

This repository contains scripts to enhance the bibliography of the Philosophie.ch website, by scraping different APIs and websites, and assuring the quality and consistency of the data.

Installation

# Install dependencies with Poetry
poetry install

CLI Tools

All commands should be run with poetry run or after activating the shell with poetry shell.

Command Description How to run
scrape-journal Scrape journal articles by ISSN via Crossref API poetry run scrape-journal --help
fuzzy-matcher Fuzzy match BibItems against bibliography poetry run fuzzy-matcher --help
raw_text_scraping_cli LLM-based web scraping for bibliographic data poetry run python -m philoch_bib_enhancer.cli.raw_text_scraping_cli --help
manual_raw_text_to_csv Convert RawTextBibitem JSON to CSV poetry run python -m philoch_bib_enhancer.cli.manual_raw_text_to_csv --help

scrape-journal

Scrape journal articles from Crossref by ISSN and year range.

poetry run scrape-journal --issn 0031-8019 --start-year 2020 --end-year 2023

Options:

  • --issn, -i (required): Journal ISSN
  • --start-year, -s (required): Start year
  • --end-year, -e (required): End year
  • --bibliography-path, -b: Path to bibliography file (.ods)
  • --column-name-bibkey, -cb: Column name for bibkey
  • --column-name-journal, -cj: Column name for journal
  • --column-name-volume, -cv: Column name for volume
  • --column-name-number, -cn: Column name for issue number

fuzzy-matcher

Match extracted BibItems against an existing bibliography using fuzzy string matching.

poetry run fuzzy-matcher \
  --input scraped_items.csv \
  --bibliography bibliography.ods \
  --output matched_results.csv

Options:

  • --input, -i (required): Input file with BibItems (.csv or .ods)
  • --bibliography, -b (required): Bibliography file (.ods)
  • --output, -o (required): Output CSV path
  • --cache-dir, -c: Cache directory (default: data/cache)
  • --top-n, -n: Number of top matches (default: 5)
  • --min-score, -m: Minimum score threshold (default: 0.0)
  • --force-rebuild: Force rebuild of index cache
  • --force-python: Use Python scorer instead of Rust

raw_text_scraping_cli

Extract bibliographic data from web pages using LLMs.

poetry run python -m philoch_bib_enhancer.cli.raw_text_scraping_cli \
  --urls https://example.com/journal/issue/1 \
  --output scraped_items.csv

Options:

  • --urls, -u: URLs to scrape (space-separated)
  • --urls-file, -f: File containing URLs (one per line)
  • --output, -o (required): Output CSV path
  • --bibliography-path, -b: Path to bibliography file (.ods)
  • --column-name-*: Column name configuration (same as scrape-journal)

manual_raw_text_to_csv

Convert manually created RawTextBibitem JSON files to CSV format.

poetry run python -m philoch_bib_enhancer.cli.manual_raw_text_to_csv \
  --input raw_items.json \
  --output converted_items.csv

Options:

  • --input, -i (required): Input JSON file
  • --output, -o (required): Output CSV path
  • --bibliography-path, -b: Path to bibliography file (.ods)
  • --column-name-*: Column name configuration (same as scrape-journal)

Environment Variables

Variable Required Description
CROSSREF_EMAIL Yes (for scrape-journal) Email for Crossref API polite pool
ANTHROPIC_API_KEY Yes (for raw_text_scraping_cli with Claude) Anthropic API key
OPENAI_API_KEY Yes (for raw_text_scraping_cli with OpenAI) OpenAI API key
LLM_SERVICE No LLM provider: claude (default) or openai
SCRAPE_JOURNAL_OUTPUT_DIR No Output directory for scrape-journal (default: .)

Quick Examples

Scrape a journal and match against bibliography

# Set required env vars
export CROSSREF_EMAIL="your.email@example.com"

# Scrape journal articles
poetry run scrape-journal \
  --issn 0031-8019 \
  --start-year 2020 \
  --end-year 2023 \
  --bibliography-path data/bibliography.ods

# Match results against bibliography
poetry run fuzzy-matcher \
  --input output.csv \
  --bibliography data/bibliography.ods \
  --output matched.csv

LLM-based web scraping

# Set required env vars
export ANTHROPIC_API_KEY="sk-ant-..."

# Scrape from URLs
poetry run python -m philoch_bib_enhancer.cli.raw_text_scraping_cli \
  --urls-file urls.txt \
  --output scraped.csv \
  --bibliography-path data/bibliography.ods

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

philoch_bib_enhancer-0.1.0.tar.gz (960.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

philoch_bib_enhancer-0.1.0-cp313-cp313-win_amd64.whl (318.5 kB view details)

Uploaded CPython 3.13Windows x86-64

philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (443.2 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (436.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_11_0_arm64.whl (403.9 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl (418.6 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

Details for the file philoch_bib_enhancer-0.1.0.tar.gz.

File metadata

  • Download URL: philoch_bib_enhancer-0.1.0.tar.gz
  • Upload date:
  • Size: 960.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.11.5

File hashes

Hashes for philoch_bib_enhancer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d2179bca392cf62103f796df3e284e2f5b31bc1777b4fca1b1fb0412f2570faf
MD5 b0679200b99574d66ad9d7901a15e8fb
BLAKE2b-256 75f4145c9c835d9db9943302a85a98ad2492e2403b3fb2526e088382e15932a5

See more details on using hashes here.

File details

Details for the file philoch_bib_enhancer-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 06692771a6a75990ace5bcd99ac5cbeddacbcadde279c2bc7adaf4b75e544118
MD5 19cdfb85ddea503478c175cc37142f14
BLAKE2b-256 44da5228b6c1033e58f9a97e4ff634ce252a3549a9976d46efc52726660ff86a

See more details on using hashes here.

File details

Details for the file philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2596b819a594398c71018479f4188924b57fb3cafb58237210df4d652bd3ad14
MD5 f98e0b28ad52f0c69c3c4bbfb0238ebf
BLAKE2b-256 db0a5613763aa01ad13e1cdb2371a2f46c6f25be204e0a9b8dec14e02ffd58a9

See more details on using hashes here.

File details

Details for the file philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.1.0-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 ad67bdddbef917ef1814d392157ca4bf43592a1ec1b4e1d4c9a7d21ba42d5a1c
MD5 2e64c90a730b4ce5c8e11e14df34075a
BLAKE2b-256 c1af06a9d9f70b0202be0c0ab3ce6d31acb62735f0cfc7e50c24cb2a40479ea2

See more details on using hashes here.

File details

Details for the file philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a3284502d16a6a4a7f254ed389e165a78c7705f161a33c554fef9afe09a4eeb5
MD5 a5e93adfdc6185ee541f15bc9f1fadab
BLAKE2b-256 36d56a050a9838d4ef01d1e4979cc1ac21c965381de2842afcc8d220a7455196

See more details on using hashes here.

File details

Details for the file philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.1.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 3c71f7119baaaf30adc2462109eefbbe93cc6a7370942eec2520d293183d14bf
MD5 ff8468fcd6a6b570a442f6bc734fad6d
BLAKE2b-256 9f38819714165a786f4cb68e35013614da354ce822fc91c0de977ca144f58bf2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page