Skip to main content

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

Project description

sparv-bert-neighbour-plugin

CI 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-bert-neighbour-plugin with

pipx inject sparv-pipeline sparv-bert-neighbour-plugin

Usage

To use this annotation you need to specify that you want to use it:

xml_export:
    annotations:
        - <token>:sparv_bert_neighbour.transformer-neighbour

Configuration

You can configure this plugin by choosing a huggingface model, huggingface transformer and the number of neighbours to generate.

Model

The model defaults to KBLab/bert-base-swedish-cased but can be configured in config.yaml:

sparv_bert_neighbour:
    model: "KBLab/bert-base-swedish-cased"

Tokenizer

The tokenizer defaults to KBLab/bert-base-swedish-cased but can be configured in config.yaml:

sparv_bert_neighbour:
    tokenizer: "KBLab/bert-base-swedish-cased"

Number of Neighbours

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

sparv_bert_neighbour:
    num_neighbours: 5

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_bert_neighbour_plugin-0.2.1.tar.gz (6.3 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