Skip to main content

A sparv plugin for computing word neighbours using a BERT model.

Project description

sparv-sbx-word-prediction-kb-bert

PyPI version PyPI - Python Version PyPI - Downloads

Maturity badge - level 2 Stage

CI(release)

Plugin for applying bert masking as a Sparv annotation.

Install

First, install Sparv, as suggested:

pipx install sparv-pipeline

Then install install sparv-sbx-word-prediction-kb-bert with

pipx inject sparv-pipeline sparv-sbx-word-prediction-kb-bert

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:
        - <token>:sbx_word_prediction_kb_bert.word-prediction--kb-bert

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

export:
    annotations:
        - <token>:sbx_word_prediction_kb_bert.word-prediction--kb-bert
        ...

Configuration

You can configure this plugin by the number of neighbours to generate.

Number of Neighbours

The number of neighbours defaults to 5 but can be configured in config.yaml:

sbx_word_prediction_kb_bert:
    num_neighbours: 5

Number of Decimals

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

sbx_word_prediction_kb_bert:
    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/bert-base-swedish-cased c710fb8dff81abb11d704cd46a8a1e010b2b022c
Tokenizer same as Model same as Model

Changelog

This project keeps a changelog.

Project details


Download files

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

Source Distribution

sparv_sbx_word_prediction_kb_bert-0.5.3.tar.gz (98.6 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page