Skip to main content

sparv-sbx-sentiment-kb-sent

PyPI version PyPI license PyPI - Python Versions

Maturity badge - level 2 Stage

CI(check) CI(test) CI(scheduled) CI(release) Codecov

Plugin for computing sentiment as a Sparv annotation.

Install

With pipx

First, install Sparv as suggested:

pipx install sparv

Then install sparv-sbx-sentiment-kb-sent with

sparv plugins install sparv-sbx-sentiment-kb-sent

or, you can also install sparv-sbx-sentiment-kb-sent with

pipx inject sparv sparv-sbx-sentiment-kb-sent

With uv-pipx

First, install Sparv as recommended:

uvpipx install sparv

Then install sparv-sbx-sentiment-kb-sent with

sparv plugins install sparv-sbx-sentiment-kb-sent

or, you can also install sparv-sbx-sentiment-kb-sent with

uvpipx install sparv-sbx-sentiment-kb-sent --inject sparv

Usage

Depending on how many explicit exports of annotations you have you can decide to use this annotation exclusively by adding it as the only annotation to export under xml_export:

xml_export:
  annotations:
    - <sentence>:sbx_sentiment_kb_sent.sentiment--kb-sent

To use it together with other annotations you might add it under export:

export:
    annotations:
        - <sentence>:sbx_sentiment_kb_sent.sentiment--kb-sent
        ...

Configuration

You can configure this plugin in the following way.

Number of Decimals

The number of decimals defaults to 3 but can be configured in config.yaml:

sbx_sentiment_kb_sent:
  num_decimals: 3

[!NOTE] This also controls the cut-off, so all values where the score round to 0.000 (or the number of decimals) is discarded.

Metadata

Model

Type HuggingFace Model Revision
Model KBLab/robust-swedish-sentiment-multiclass b0ec32dca56aa6182a6955c8f12129bbcbc7fdbd
Tokenizer KBLab/megatron-bert-large-swedish-cased-165k 90c57ab49e27b820bd85308a488409dfea25600d

Supported Python versions

This library thrives to support a Python version to End-Of-Life, and will at least bump the minor version when support for a Python version is dropped.

The following versions of this library supports these Python versions:

  • v0.4: Python 3.11
  • v0.3: Python 3.11
  • v0.2: Python 3.8

Changelog

This project keeps a changelog.

License

This repository is licensed under the MIT license.

Development

Development prerequisites

For starting to develop on this repository:

  • Clone the repo (in one of the ways below): (in one of the ways below):
    • git clone git@github.com:spraakbanken/sparv-sbx-sentiment-kb-sent.git
    • git clone https://github.com/spraakbanken/sparv-sbx-sentiment-kb-sent.git
  • Setup environment: make dev
  • Install pre-commit hooks: pre-commit install

Do your work.

Tasks to do:

  • Test the code with make test or make test-w-coverage.
  • Lint the code with make lint.
  • Check formatting with make check-fmt.
  • Format the code with make fmt.
  • Type-check the code with make type-check.
  • Test the examples with:
    • make test-example-small-txt
    • make test-example-issue-10

This repo uses conventional commits.

Release a new version

sparv-sbx-sentiment-kb-sent

  • Prepare the CHANGELOG: make prepare-release.
  • Edit CHANGELOG.md to your liking.
  • Add to git: git add --update
  • Commit with git commit -m 'chore(release): prepare release' or cog commit chore 'prepare release' release.
  • Bump version (depends on `bump-my-version)
    • Major: make bumpversion part=major
    • Minor: make bumpversion part=minor
    • Patch: make bumpversion part=patch or make bumpversion
  • Push main and tags to GitHub: git push main --tags or make publish
  • Add metadata for Språkbanken's resource

Metadata

Release files for sparv-sbx-sentiment-kb-sent 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sparv-sbx-sentiment-kb-sent 0.4.1
File Size Uploaded
sparv_sbx_sentiment_kb_sent-0.4.1.tar.gz 6.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sparv-sbx-sentiment-kb-sent 0.4.1
File Interpreter ABI Platform
sparv_sbx_sentiment_kb_sent-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / sparv_sbx_sentiment_kb_sent-0.4.1.tar.gz

Download URL sparv_sbx_sentiment_kb_sent-0.4.1.tar.gz
Size 6.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7270bc4c46bacff3168d77464a6709daf314defb39f12c1b5d0c7b109f802a03
BLAKE2b-256 checksum
How to use checksums
02d94d2f9cb29b0ceb1bd0461b727d71f20a1ee4d82869baa19a8556f9f98baa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / sparv_sbx_sentiment_kb_sent-0.4.1-py3-none-any.whl

Download URL sparv_sbx_sentiment_kb_sent-0.4.1-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
334680834e0cbd0e09f0a5e948f13ca5a247a9729f1c353241ae2f3199b3f923
BLAKE2b-256 checksum
How to use checksums
a0ba0053a7862c4d2f8597dea7021a03ed6fb0e069d686a128b54708ccec6689
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files

0.4.0

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