A sparv plugin for computing word neighbours using a BERT model.
Project description
sparv-bert-neighbour-plugin
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
Release history Release notifications | RSS feed
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
Hashes for sparv_bert_neighbour_plugin-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e242f9e8dd47b911c1471b54a6f0b973abacd81d3eda11723238fbfc275ecd0c |
|
MD5 | b69c587fe81d1b6e55e0d8800b467d63 |
|
BLAKE2b-256 | 3aa80a9c1c9b76ed8d620c70e706c76f0419b9aa8811dd3ad602f5baf5a2f17f |
Hashes for sparv_bert_neighbour_plugin-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f9db9a2ee60ce12f1786ac6ab8d88fb56aabd5558e734961617a49582f7e46 |
|
MD5 | 6b05d457b26df59d86e463e4dd3f10bb |
|
BLAKE2b-256 | adbe759e973550c2505660fd7bb0d69983ce1ed03a4b4a09b876d2dea8f143f5 |