Skip to main content

ClassiVax

Classify vaccine-related news headlines into topic categories using a Recognizing Textual Entailment (RTE) approach, powered by the LuizNeves/BERT-NLI-vaccine-v2 model.

Built on the method described in:

Neves, L. F. F., Camargo, C. Q., & Massarani, L. (2025). Boosting Transformers: Recognizing Textual Entailment for Classification of Vaccine News Coverage. Computational Communication Research, 7(1), 1–32. https://doi.org/10.5117/CCR2025.1.1.NEVE

Installation

pip install classivax

Usage

Default classes (10 vaccine-related topics from the paper)

from classivax import ClassiVaxClassifier

clf = ClassiVaxClassifier()

result = clf.classify("Twitter will begin removing vaccine misinformation")
print(result["class"])   # "Vaccine Hesitancy and Mis-/Disinformation"
print(result["score"])   # e.g. 0.999

Batch classification

headlines = [
    "Twitter will begin removing vaccine misinformation",
    "Britain begins coronavirus vaccine rollout",
    "COVID-19 vaccination key to economic recovery",
]

df = clf.classify_batch(headlines)
print(df)

Custom classes

The underlying RTE approach also supports classifying text against any set of natural-language class descriptions you define — not just the original 10 classes.

custom_classes = {
    "Vaccine Safety Debate": "The headline discusses concerns, controversies, or debates about vaccine safety",
    "Vaccine Logistics": "The headline discusses shipping, storage, cold chain, or distribution logistics for vaccines",
}

clf = ClassiVaxClassifier(classes=custom_classes)
result = clf.classify("Cold storage shortages delay vaccine shipments to rural areas")
print(result["class"])  # "Vaccine Logistics"

Note: the underlying model was fine-tuned specifically on English-language, vaccine-related headlines from 2020–2021. Using custom classes outside this domain is supported, but accuracy has not been formally evaluated beyond the original study's scope — treat results on very different domains with appropriate caution.

The 10 default classes

Class Description
Global Access to Vaccine Initiatives for equal access to COVID-19 vaccines (e.g., COVAX), and/or the need to combat inequity, ensure global distribution, and contain the disease, especially in low- and middle-income countries
Science and Technology The science behind vaccine development, including research, studies, safety and efficacy trials, emergency approval, and side effects
Public Health Policies Vaccine mandates, vaccine passports, and/or other public health policies such as social distancing, quarantine, lockdowns, and mask mandates
Vaccination Rollout/Campaign Vaccination rollout, campaigns, priority groups, vaccine deals, and/or the monitoring of vaccination rates
Vaccine Hesitancy and Mis-/Disinformation The circulation of disinformation and misinformation regarding vaccines, which contribute to vaccine hesitancy and reluctance
Public Endorsement to Vaccine Public endorsement and incentive for vaccines, such as celebrities and artists getting vaccinated
Institutional Affairs Institutional and governmental issues, political disputes, conflicts, political authorities, and export bans
Problems in Vaccination Problems in vaccination, such as delays, fraud, disparities, vaccine shortages
Public Perception of Vaccine Opinion polls and surveys on the public perception of vaccines and/or willingness to get vaccinated
Economic Consequences The impacts and benefits of vaccination on the economy

How it works

For each headline, the classifier tests it against every class description as a text-hypothesis pair, following the entailment framework: the headline is the text (T), and each class description is a candidate hypothesis (H). The class whose description achieves the highest entailment score is selected as the prediction.

Citation

If you use this library or the underlying model in your research, please cite:

@article{neves2025boosting,
  title={Boosting Transformers: Recognizing Textual Entailment for Classification of Vaccine News Coverage},
  author={Neves, Luiz F. F. and Camargo, Chico Q. and Massarani, Luisa},
  journal={Computational Communication Research},
  volume={7},
  number={1},
  pages={1--32},
  year={2025},
  doi={10.5117/CCR2025.1.1.NEVE}
}

License

MIT

Metadata

Release files for classivax 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 classivax 0.1.0
File Size Uploaded
classivax-0.1.0.tar.gz 6.7 kB Details

Built distribution (wheel)

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

Total release size: 14.0 kB

Release files / classivax-0.1.0.tar.gz

Download URL classivax-0.1.0.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0c4f1fc7bc8251c1f07077dda13c321331a6515506094aad17fbb2be64e1f906
BLAKE2b-256 checksum
How to use checksums
9ecb461f620c40ea21bba9935263b5160123b0bfb297ca6aa7db5147294c0ab9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.8

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

Download URL classivax-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
440738da5c21cacd402095dafd4a4d5592ac5d86feeb954ccb6416e012204002
BLAKE2b-256 checksum
How to use checksums
89081f25c66bec519021b33acaa26b3203b6e64924b8c7d75ba4e2e854c27c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.8

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

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