Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Riccorl authored Nov 26, 2020
1 parent bed3f30 commit 98d6370
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,43 @@

Semantic Role Labeling based on [AllenNLP implementation](https://demo.allennlp.org/semantic-role-labeling) of [Shi et al, 2019](https://arxiv.org/abs/1904.05255). Can be trained using both PropBank and [VerbAatlas](http://verbatlas.org/) inventories and implements also the predicate disambiguation task, in addition to arguments identification and disambiguation.

### To-Dos
### How to use

- [x] 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)
Install the library

```bash
pip install transformer-srl
```

Download the pretrained model `srl_bert_base_conll2012.tar.gz` from [here](https://www.dropbox.com/s/4tes6ypf2do0feb/srl_bert_base_conll2012.tar.gz).

| File | Model | Version | F1 Argument | F1 Predicate |
| :---: | :---: | :---: | :---: | :---: |
| srl_bert_base_conll2012.tar.gz | `bert-base-cased` | 2.4.6 | 86.0 | 95.5 |

#### CLI

```bash
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

```python
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`:
Expand All @@ -39,3 +63,10 @@ With `bert-base-multilingual-cased`:
- F1 arguments 86.1
- F1 predicates 94.9
```

### To-Dos

- [x] 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)

0 comments on commit 98d6370

Please sign in to comment.