Semantic Role Lableing with BERT
Semantic Role Labeling based on AllenNLP implementation of Shi et al, 2019. Can be trained using both PropBank and VerbAatlas inventories and implements also the predicate disambiguation task, in addition to arguments identification and disambiguation.
How to use
Install the library
pip install transformer-srl
Download the pretrained model srl_bert_base_conll2012.tar.gz from here.
| File | Model | Version | F1 Argument | F1 Predicate |
|---|---|---|---|---|
| srl_bert_base_conll2012.tar.gz | bert-base-cased |
2.4.6 | 86.0 | 95.5 |
CLI
echo '{"sentence": "Did Uriah honestly think he could beat the game in under three hours?"}' | \
allennlp predict path/to/srl_bert_base_conll2012.tar.gz - --include-package transformer_srl
Inside Python Code
from transformer_srl import dataset_readers, models, predictors
predictor = predictors.SrlTransformersPredictor.from_path("path/to/srl_bert_base_conll2012.tar.gz, "transformer_srl")
predictor.predict(
sentence="Did Uriah honestly think he could beat the game in under three hours?"
)
Infos
- Language Model: BERT
- Dataset: CoNLL 2012
Results with VerbAtlas
With bert-base-cased:
# Dev set
- F1 arguments 87.6
- F1 predicates 95.5
# Test set
- F1 arguments x
- F1 predicates x
With bert-base-multilingual-cased:
# Dev set
- F1 arguments 86.2
- F1 predicates 94.2
# Test set
- F1 arguments 86.1
- F1 predicates 94.9
To-Dos
- Works with both PropBank and VerbAtlas (infer inventory from dataset reader)
- Compatibility with all models from Huggingface's Transformers. - Now works only with models that accept 1 as token type id
- Predicate identification (without using spacy)
Metadata
Release files for transformer-srl 2.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| transformer_srl-2.5.2.tar.gz | 39.7 kB | Without provenance | Details for transformer_srl-2.5.2.tar.gz |
Release files / transformer_srl-2.5.2.tar.gz
| Download URL | transformer_srl-2.5.2.tar.gz |
|---|---|
| Size | 39.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2b7a1802b82dff583ad456d9731277b7d6ac7d869b00ed741e632ae23d914f48
|
|
BLAKE2b-256 checksum How to use checksums |
ff82291d469c3692938c12c8a5403a7c7a053159f383176a6ec3d8503137fdf6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|
Security for transformer-srl 2.5.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.