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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4b863d3f9e9573363bc469e42b1a830ae584143833477e457a7625c14b0b866 |
|
MD5 | ed1b0a2fea51cb91fb7856d9dedefc11 |
|
BLAKE2b-256 | 11109a809035925b8655d4059f8b82060f39aef051f0f3943fa33be7c0d9cf46 |
Hashes for sparv_word_prediction_kb_bert_plugin-0.5.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 478b5dae8e8324e7cddc5912af1a862348b66524108e061c019ebf07eda101ea |
|
MD5 | be9cae03c5d7745b3f760fc4199ce434 |
|
BLAKE2b-256 | 3c2a4deafcf3ac505eb5c6aa14cdbcf2ccfcb84ec8e33fab9576a01a886499dd |