Skip to main content

sparv-sbx-emotions-kb-emoclass

PyPI version PyPI license PyPI - Python Version

Maturity badge - level 2 Stage

codecov

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

Plugin to Sparv plugin to annotate sentences, paragraphs and texts with emotional classification.

Install

First, install Sparv as suggested,

with pipx:

pipx install sparv

or, with uv-pipx:

uvpipx install sparv

Then install sparv-sbx-emotions-kb-emoclass with,

if you used pipx above:

pipx inject sparv sparv-sbx-emotions-kb-emoclass

or, if you used uv-pipx above:

uvpipx install sparv-sbx-emotions-kb-emoclass --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_emotions_kb_emoclass.emotion--kb-emoclass

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

export:
    annotations:
        - <sentence>:sbx_emotions_kb_emoclass.emotion--kb-emoclass
        ...

Configuration

You can configure this plugin in the following ways.

Language of Annotations

The language of the annotations defaults to en (English), but you can change that to sv (Swedish).

# file: config.yaml
sbx_emotions_kb_emoclass:
  annotation_lang: sv

Metadata

Model

Type HuggingFace Model Revision
Model KBLab/emotional-classification 73f1663770e79ff5c1aa12a38063a13537a02ce0

Known issues

  • InconsistentWarning because of using scikit-learn of version 1.7.2. See Issue 11.
    • Solved with: scikit-learn<1.3.0 and numpy<2.0.0

[!NOTE] You might need to put export CFLAGS="-Wno-error=incompatible-pointer-types" ; export CXXFLAGS="-Wno-error=incompatible-pointer-types" before installing

Minimum Supported Python Version Policy

The Minimum Supported Python Version is fixed for a given minor (1.x) version. However it can be increased when bumping minor versions, i.e. going from 1.0 to 1.1 allows us to increase the Minimum Supported Python Version. Users unable to increase their Python version can use an older minor version instead. Below is a list of sparv-sbx-emotions-kb-emoclass versions and their Minimum Supported Python Version:

  • v0.1: Python 3.11.

Note however that sparv-sbx-emotions-kb-emoclass also has dependencies, which might have different MSPV policies. We try to stick to the above policy when updating dependencies, but this is not always possible.

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):
    • git clone git@github.com:spraakbanken/sparv-sbx-emotions-kb-emoclass.git
    • git clone https://github.com/spraakbanken/sparv-sbx-emotions-kb-emoclass.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

This repo uses conventional commits.

Release a new version

  • 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-emotions-kb-emoclass 0.1.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-emotions-kb-emoclass 0.1.1
File Size Uploaded
sparv_sbx_emotions_kb_emoclass-0.1.1.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sparv-sbx-emotions-kb-emoclass 0.1.1
File Interpreter ABI Platform
sparv_sbx_emotions_kb_emoclass-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / sparv_sbx_emotions_kb_emoclass-0.1.1.tar.gz

Download URL sparv_sbx_emotions_kb_emoclass-0.1.1.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
661fc7c186468b419c37cf6e80a21d37ea67b7b6b56de1f34e0703d8a9c7ea26
BLAKE2b-256 checksum
How to use checksums
ab2377d2038849c2206c3549203701dcda1e30017bc9811f25bdfcc34333b31f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.5

Release files / sparv_sbx_emotions_kb_emoclass-0.1.1-py3-none-any.whl

Download URL sparv_sbx_emotions_kb_emoclass-0.1.1-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c330c0ec218521f4a3509858b7a494931c5e85b55d659c630e9cea75caadf00
BLAKE2b-256 checksum
How to use checksums
db4c9705d29488d4bf42c426b14b611511dcf741e96d7e482a41b2a5ddce1b02
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.1.1 This release

2 release files

0.1.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