Skip to main content

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

Project description

sparv-word-prediction--kb-bert-plugin

PyPI version

Plugin for applying bert masking as a Sparv annotation.

Install

First, install Sparv, as suggested:

pipx install sparv-pipeline

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

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

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

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

export:
    annotations:
        - <token>: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:

word_prediction_kb_bert:
    num_neighbours: 5

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

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