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.2.1.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.2.1-cp313-cp313-win_amd64.whl (318.4 kB view details)

Uploaded CPython 3.13Windows x86-64

philoch_bib_enhancer-0.2.1-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.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (435.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

philoch_bib_enhancer-0.2.1-cp313-cp313-macosx_11_0_arm64.whl (403.7 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

philoch_bib_enhancer-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl (418.7 kB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: philoch_bib_enhancer-0.2.1.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.2.1.tar.gz
Algorithm Hash digest
SHA256 1003abcdee4b48b5378666390b7398eedfcf169ef5034a6856d12a06f2f7f0c8
MD5 6737e02f27fb496e89cb044bc1ddc507
BLAKE2b-256 97c3599f952eb2290cb479b5b1bd598804af89d51e3f3e4c8db6b0775bd65d67

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.2.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 bba8f856e9411e9d41c04983c7baaae6ade3e6acd71e58d81fb13f39628570c7
MD5 d99a494a536c91c0b8ff41fe387a59cb
BLAKE2b-256 7c326e7db32b1893b3af01cdd76a6f4ee662e8788cd5a43fb953b03471544151

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.2.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1695fe2c4ead696eb34cce8fd1385dd1a3c9a76624c586f159cb564653a7ffaf
MD5 c19bfd7b7c4bebb6436955ea9b56050d
BLAKE2b-256 86f2647bcaef484771b6bbdf1e6589b3bcde0aae7080acbb161e3edb7fed19ad

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.2.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 3e4c425dcad66b41c9e8dbe273837900694d9b9ee595a1f18e6d2ee091247bd9
MD5 05edf751b4335f6dbb95327532b72838
BLAKE2b-256 8f5b66ca79fa4dcf2c67663eeb19d088a6c101862476a4b1ad0b713f920a2730

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.2.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9fd05c2e3fbf02d43dff4dd888fe552c0a84c50575535051b266b245973b32a3
MD5 4ef67a4a5ba7a56456336e2249b011d1
BLAKE2b-256 e6857cde46661dff26aa1f03e5fa218f85742cc01b18934ad3e3bca2d9f50a23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for philoch_bib_enhancer-0.2.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4b2601ba674e20ed2de4059b4142bc2ff725ec09ee1d2c7265bf65a6b3c698f1
MD5 2e7bbd939187d4e33f9ce9703120c13f
BLAKE2b-256 1d26a0024de76aceeb3f939df9ac91bc09667f4e471d68f0006ad542c42da1a7

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