polVADER
Lexicon-and-rule-based sentiment analysis for Polish text, in the style of
VADER. No training required at
inference time — polVADER scores text directly from a Polish sentiment
lexicon plus a rule layer for negation, intensifiers, capitalization,
punctuation emphasis, and contrastive conjunctions (ale, jednak, ...).
Install
pip install polvader
python -m spacy download pl_core_news_lg
polVADER uses spaCy's pl_core_news_lg model for Polish tokenization and
lemmatization; it is not bundled with the package and must be downloaded
once after install.
Usage
from polvader import Lexicon
lex = Lexicon()
scores = lex.polarity_scores("To był wspaniały dzień pełen szczęścia.")
print(scores)
# {'neg': 0.0, 'neu': 0.xxx, 'pos': 0.xxx, 'compound': 0.879}
polarity_scores() returns the same {neg, neu, pos, compound} contract as
the original English VADER. compound is a single normalized score in
[-1, +1]; neg/neu/pos are proportions of the text's sentiment-bearing
content.
Batch scoring (uses spaCy's nlp.pipe internally, much faster than a loop):
results = lex.score_batch([
"Świetny produkt, polecam!",
"Nigdy więcej tu nie wrócę.",
], batch_size=256)
For social-media text (tweets, comments — hashtags, @mentions, emoji), run
preprocess_social() first:
from polvader import preprocess_social
text = preprocess_social(raw_tweet)
scores = lex.polarity_scores(text)
Lexicon
By default Lexicon() loads the coverage-expanded, weight-tuned lexicon
(~29.5k words): the original ~8.5k-word hand-built Polish valence lexicon,
expanded via K-NN over PLLuM-8B's static input-embedding table (not a
contextual/forward-pass embedding — benchmarked as equal-or-better and far
cheaper to compute) across a multi-domain Polish corpus (tweets,
product/hotel/service reviews, general sentiment text), then weight-tuned
end-to-end against those same domains. Pass expanded=False for the
smaller, untuned ~8.5k-word base lexicon instead:
lex = Lexicon(expanded=False)
Modifier system
polarity_scores() applies, on top of the raw lexicon lookup:
negation (nie, multi-word negators), booster/dampener adverbs, ALL-CAPS
emphasis, exclamation/question-mark emphasis, sentence-aware scoring for
multi-sentence text, and contrastive-conjunction reweighting (text after
"ale"/"jednak" counts more than text before it). Each category can be
disabled independently via keyword flags on polarity_scores() for
ablation/diagnostic purposes — see its docstring for the full flag list.
License
MIT
Funding disclosure
This work was supported by Narodowe Centrum Nauki (National Science Centre, Poland) under Grant 2020/38/A/HS6/00066.
Metadata
Release files for polvader 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| polvader-1.0.1.tar.gz | 4.2 MB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| polvader-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 MB
Release files / polvader-1.0.1.tar.gz
| Download URL | polvader-1.0.1.tar.gz |
|---|---|
| Size | 4.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bb85c0913269dcd8cdd9de5b965fd42af12aca083df61e5b4e0850f1a06dae82
|
|
BLAKE2b-256 checksum How to use checksums |
e272540d0b24d18d4e9fbbddd663f32ec78c47f51de96cf99774262f38088786
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / polvader-1.0.1-py3-none-any.whl
| Download URL | polvader-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
227e0edd639b5b5ee079090a02e9f128a93bd65d04ffc022f4d410982e577f6c
|
|
BLAKE2b-256 checksum How to use checksums |
dcc8d876a532509d54820815b18588f798cfbd6d2c8702cf511e9c8cb98d09f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for polvader 1.0.1
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.