Skip to main content

Sparv-Superlim: A plugin for classifying text using the models trained on tasks in Superlim

Sparv-Superlim is a Sparv plugin for classifying text using the Superlim baseline models. Superlim is a multi-task benchmark for Swedish, which includes baseline models.

How to use?

Install Sparv-Superlim by injecting it into the Sparv Pipeline:

pipx inject sparv-pipeline git@github.com:spraakbanken/sparv-sbx-superlim.git

See the Sparv documentation for more details on how to install plugins.

Then make a config file and choose the relevant annotations:

metadata:
  id: corpora
  name:
    eng: corpora
    swe: korpora
  language: swe
  description:
    eng: Swedish political manifestos with Superlim annotations
    swe: Svenska valmanifest med Superlimannoteringar
import:
  source_dir: source_small
  importer: text_import:parse
export:
  default:
    - xml_export:pretty
    - sbx_superlim:predictions
  annotations:
    - <token>
    - <sentence>
    - <sentence>:sbx_superlim.migration_stance
    - <sentence>:sbx_superlim.nuclear_stance
sbx_superlim:
  hf_model_path:
    absabank-imm: 'sbx/bert-base-swedish-cased_absabank-imm'
    argumentation: 'sbx/bert-base-swedish-cased-argumentation_sent'
  hf_inference_args:
    batch_size: 32

Plugin-specicific variables which start with hf are HuggingFace parameters. The most important one is the hf_model_path which tells which fine-tuned model to use for each task.

Full working examples can be found in the examples folder.

Available annotations

So far, Sparv-Superlim provides 10 different annotations. These are summarized in the table below:

Superlim task Sparv-Superlim Annotation Annotation Label Segment
absabank-imm migration_stance Attitude towards immigration float between 1-5 sentence
argumentation- sentences [topic]_stance Stance to a given topic pro, con or neutral sentence
dalaj-ged correct_swedish Correct Swedish correct or incorrect sentence
swenli previous_entailment The logical relationship of two sentences entailment, contradiction or neutral sentence pair
sweparaphrase similarity Similarity between two sentences float between 1-5 sentence pair

Wish to contribute?

Do you have new, innovative ways of incorporating models trained on Superlim into Sparv-Superlim? Make a feature request or even better a pull request!

How to cite?

Please cite the following technical report: Felix Morger. 2024. When Sparv met Superlim…A Sparv plugin for natural language understanding analysis of Swedish. Tech. rep. University of Gothenburg. You can also use the bibtex entry below.

@techreport{sparv-superlim,
  title =	 {When {S}parv met {S}uperlim\ldots {A} {S}parv Plugin for Natural Language Understanding Analysis of {S}wedish},
  author =	 {Morger, Felix},
  url = {https://hdl.handle.net/2077/83664},
  year =	 {2024},
  publisher = {Språkbanken Text},
  institution =	 {University of Gothenburg},
}

Metadata

Release files for sparv-sbx-superlim 0.1.0

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-superlim 0.1.0
File Size Uploaded
sparv_sbx_superlim-0.1.0.tar.gz 17.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sparv-sbx-superlim 0.1.0
File Interpreter ABI Platform
sparv_sbx_superlim-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.3 kB

Release files / sparv_sbx_superlim-0.1.0.tar.gz

Download URL sparv_sbx_superlim-0.1.0.tar.gz
Size 17.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8cf780757deb0ec07c56259daa1b9046ea0c1fc9ef2390f7ce5b335c64e8483f
BLAKE2b-256 checksum
How to use checksums
d6f116d778f88ddd2ea8ce5fa78dc8eb0dc0b2fe00ed6c8e2bd4e79ad9f5360f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.13

Release files / sparv_sbx_superlim-0.1.0-py3-none-any.whl

Download URL sparv_sbx_superlim-0.1.0-py3-none-any.whl
Size 21.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4096eee5437c5c304fb2008153efae39c21c23ed332405e61809a90b30604043
BLAKE2b-256 checksum
How to use checksums
1e51b4142a3d87618b7f11759d9bef0b7184392ebe7bd0c4500e8e4661e2b8b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.0 This release

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