Skip to main content

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.

Download files

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

Source Distribution

polvader-1.0.1.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

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

polvader-1.0.1-py3-none-any.whl (4.2 MB view details)

Uploaded Python 3

File details

Details for the file polvader-1.0.1.tar.gz.

File metadata

  • Download URL: polvader-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for polvader-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bb85c0913269dcd8cdd9de5b965fd42af12aca083df61e5b4e0850f1a06dae82
MD5 f8cd2a465e50c86c642d224c54d9e16c
BLAKE2b-256 e272540d0b24d18d4e9fbbddd663f32ec78c47f51de96cf99774262f38088786

See more details on using hashes here.

File details

Details for the file polvader-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: polvader-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for polvader-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 227e0edd639b5b5ee079090a02e9f128a93bd65d04ffc022f4d410982e577f6c
MD5 43d42a3e8db536f52e4b60d16f92d367
BLAKE2b-256 dcc8d876a532509d54820815b18588f798cfbd6d2c8702cf511e9c8cb98d09f1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 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