Skip to main content

eurovoc

A standalone, open-source EuroVoc classifier. It tags any text into the EU's official subject space: 7,029 descriptors (IDs) rolled up to 127 microthesauri (MT) and 21 domains (DO), multilingual including Catalan.

A modern, open successor to the 2021 PyEuroVoc package (which fine-tuned a per-language BERT, truncated documents to 512 tokens, and no longer loads under transformers 5.x), and the natural home for a retrained long-context model.

How it works

Default backend is zero-shot retrieval: a multilingual sentence-transformers model (intfloat/multilingual-e5-base) embeds the text and the EuroVoc descriptor labels (cached once), and returns the top-K by cosine behind a confidence gate. The gate prefers returning nothing over wrong tags, so proper-noun-heavy or off-topic text yields []. This is a port of Brubru's production classifier, not a trained multi-label model.

Install

pip install "brubru-eurovoc[local]"      # [local] pulls sentence-transformers

The distribution is named brubru-eurovoc (the name eurovoc was already taken on PyPI), but the import name is eurovoc:

import eurovoc

The package itself only needs numpy; the [local] extra adds the model. The first classify() downloads the model (~1 GB) and computes the label-embedding matrix once, caching it under ~/.cache/eurovoc/.

Usage

import eurovoc

for d in eurovoc.classify("Markets in crypto-assets regulation"):
    print(d.label, "|", d.domain, d.domain_label, "|", round(d.score, 3))
# financial instrument | 24 FINANCE | 0.88 ...

eurovoc.classify("Regulació de la protecció de dades personals")  # multilingual
eurovoc.classify("xyzzy plugh")   # -> []  (gate rejects noise)

Each result is a Descriptor(id, label, score, mt, domain, domain_label). The 21 domains are in eurovoc.DOMAINS.

Interop with the Brubru API

Enrich the raw descriptors the API (or the brubru SDK) returns:

import eurovoc
tags = eurovoc.from_descriptors(extract_item["eurovoc_descriptors"])

Or classify a live EU URL through Brubru's hosted extract engine (needs the brubru SDK and a key):

pip install "brubru-eurovoc[brubru]"
tags = eurovoc.classify_url("https://environment.ec.europa.eu/news_en", api_key="brubru_live_...")

Configuration (env vars)

EUROVOC_ST_MODEL, EUROVOC_TOPK, EUROVOC_MIN_SCORE, EUROVOC_MIN_MARGIN, EUROVOC_MIN_CLUSTER, EUROVOC_CACHE_DIR.

Tests

pip install -e '.[test,local]'
pytest -m "not model"     # fast: enrichment, pruning, packaging (no model)
pytest -m model           # loads the model and classifies real text

MIT licensed. Built by Beresol BV. EuroVoc is a trademark of the Publications Office of the European Union.

Metadata

Release files for brubru-eurovoc 0.1.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 brubru-eurovoc 0.1.0
File Size Uploaded Provenance
brubru_eurovoc-0.1.0.tar.gz 129.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for brubru-eurovoc 0.1.0
File Interpreter ABI Platform
brubru_eurovoc-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 260.6 kB

Release files / brubru_eurovoc-0.1.0.tar.gz

Download URL brubru_eurovoc-0.1.0.tar.gz
Size 129.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9bb9e4b0632e07d13482179624bf02423839113fd6896e37c36a3528bd4a312d
BLAKE2b-256 checksum
How to use checksums
00040034ca98e8d6e1618608582e64ff47a130ff3ad9dc328043da3c475ada69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Release files / brubru_eurovoc-0.1.0-py3-none-any.whl

Download URL brubru_eurovoc-0.1.0-py3-none-any.whl
Size 131.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17fa6906b0eb4f243f54403a9e9d82028cf8bcae13c3dac81085e8f2dda51ab8
BLAKE2b-256 checksum
How to use checksums
57bd28d72b6392e1462471263d8754ae6bac2f973eb0efeddfb899580a66ef36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

Security for brubru-eurovoc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for brubru_eurovoc-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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