A sparv plugin for computing word neighbours using a BERT model.
Project description
sparv-word-prediction--kb-bert-plugin
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
Number of Decimals
The number of decimals defaults to 3
but can be configured in config.yaml
:
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
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_word_prediction_kb_bert_plugin-0.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | fceaa126de785f569e0f78db0dce1f78e625b0b1547c699d5f4fe107058edd6d |
|
MD5 | dc82fe79e5e5eeec0b2c7c775dc5bac2 |
|
BLAKE2b-256 | e8415f6e1ba9b31606d85745147b5a3cc41aed92e0a5d30647fe1c5bfb2de238 |
Hashes for sparv_word_prediction_kb_bert_plugin-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f095240e09fa5f7e980258993e79203ff9a0817d933be18fdadcf258b1dd35ec |
|
MD5 | 6034838c745dd8f0feda8f10e7e2aa20 |
|
BLAKE2b-256 | 9bf6b7d460b203a55628604657657491aa7141b9a98fa4e72f16fcf13dc6f881 |