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
File details
Details for the file sparv_bert_neighbour_plugin-0.2.1.tar.gz
.
File metadata
- Download URL: sparv_bert_neighbour_plugin-0.2.1.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e242f9e8dd47b911c1471b54a6f0b973abacd81d3eda11723238fbfc275ecd0c |
|
MD5 | b69c587fe81d1b6e55e0d8800b467d63 |
|
BLAKE2b-256 | 3aa80a9c1c9b76ed8d620c70e706c76f0419b9aa8811dd3ad602f5baf5a2f17f |
File details
Details for the file sparv_bert_neighbour_plugin-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: sparv_bert_neighbour_plugin-0.2.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c1f9db9a2ee60ce12f1786ac6ab8d88fb56aabd5558e734961617a49582f7e46 |
|
MD5 | 6b05d457b26df59d86e463e4dd3f10bb |
|
BLAKE2b-256 | adbe759e973550c2505660fd7bb0d69983ce1ed03a4b4a09b876d2dea8f143f5 |