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

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.0.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.0-py3-none-any.whl (4.2 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polvader-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 dfb748e110763e272a3c05b595d03dc3d454f4412fad4b534a0dfae121628a76
MD5 be143e870c4e32ed26b0b52456836e37
BLAKE2b-256 671f1d43de5e8459dd1dc4651c4c2021f6202bd54e7a5f435829630936505353

See more details on using hashes here.

File details

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

File metadata

  • Download URL: polvader-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9117596d390ba84648679fa21072e1ef4d2252c5dd1d241bbfd61e9884129f2d
MD5 7035d6c4904df1d8192156e29a24553a
BLAKE2b-256 781ce2eb21e0d8880c6e5ae8b479d51e54248201cfc002484585881551b9425e

See more details on using hashes here.

Release history Release notifications | RSS feed

1.0.1

2 files

This release

1.0.0 This release

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