marquesafonso
commited on
Commit
•
a83b114
1
Parent(s):
e606528
add example fix highlight for dark mode
Browse files
README.md
CHANGED
@@ -3,11 +3,11 @@ license: mit
|
|
3 |
language:
|
4 |
- pt
|
5 |
---
|
6 |
-
# bertimbau-large-ner-
|
7 |
|
8 |
This model card aims to simplify the use of the [portuguese Bert, a.k.a, Bertimbau](https://github.com/neuralmind-ai/portuguese-bert) for the Named Entity Recognition task.
|
9 |
|
10 |
-
For this model card the we used the <mark style="background-color:
|
11 |
|
12 |
Available classes are:
|
13 |
+ PESSOA
|
@@ -27,8 +27,8 @@ Available classes are:
|
|
27 |
# Load model directly
|
28 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
29 |
|
30 |
-
tokenizer = AutoTokenizer.from_pretrained("marquesafonso/bertimbau-large-ner-
|
31 |
-
model = AutoModelForTokenClassification.from_pretrained("marquesafonso/bertimbau-large-ner-
|
32 |
|
33 |
```
|
34 |
|
@@ -37,22 +37,15 @@ model = AutoModelForTokenClassification.from_pretrained("marquesafonso/bertimbau
|
|
37 |
```
|
38 |
from transformers import pipeline
|
39 |
|
40 |
-
pipe = pipeline("ner", model="marquesafonso/bertimbau-large-ner-
|
41 |
|
42 |
-
sentence = "
|
43 |
|
44 |
result = pipe([sentence])
|
45 |
|
46 |
print(f"{sentence}\n{result}")
|
47 |
|
48 |
-
|
49 |
-
# [[
|
50 |
-
# {'entity_group': 'PESSOA', 'score': 0.99694395, 'word': 'Ederson', 'start': 9, 'end': 16},
|
51 |
-
# {'entity_group': 'PESSOA', 'score': 0.9918462, 'word': 'Rúben Dias', 'start': 28, 'end': 38},
|
52 |
-
# {'entity_group': 'ORGANIZACAO', 'score': 0.96376556, 'word': 'Manchester City', 'start': 69, 'end': 84},
|
53 |
-
# {'entity_group': 'PESSOA', 'score': 0.9993823, 'word': 'Gonçalo Ramos', 'start': 104, 'end': 117},
|
54 |
-
# {'entity_group': 'ORGANIZACAO', 'score': 0.9033079, 'word': 'Benfica', 'start': 157, 'end': 164}
|
55 |
-
# ]]
|
56 |
```
|
57 |
|
58 |
## Acknowledgements
|
|
|
3 |
language:
|
4 |
- pt
|
5 |
---
|
6 |
+
# bertimbau-large-ner-total
|
7 |
|
8 |
This model card aims to simplify the use of the [portuguese Bert, a.k.a, Bertimbau](https://github.com/neuralmind-ai/portuguese-bert) for the Named Entity Recognition task.
|
9 |
|
10 |
+
For this model card the we used the <mark style="background-color: grey"> BERT-CRF (total scenario, 10 classes) </mark> model available in the [ner_evaluation](https://github.com/neuralmind-ai/portuguese-bert/tree/master/ner_evaluation) folder of the original Bertimbau repo.
|
11 |
|
12 |
Available classes are:
|
13 |
+ PESSOA
|
|
|
27 |
# Load model directly
|
28 |
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
29 |
|
30 |
+
tokenizer = AutoTokenizer.from_pretrained("marquesafonso/bertimbau-large-ner-total")
|
31 |
+
model = AutoModelForTokenClassification.from_pretrained("marquesafonso/bertimbau-large-ner-total")
|
32 |
|
33 |
```
|
34 |
|
|
|
37 |
```
|
38 |
from transformers import pipeline
|
39 |
|
40 |
+
pipe = pipeline("ner", model="marquesafonso/bertimbau-large-ner-total", aggregation_strategy='simple')
|
41 |
|
42 |
+
sentence = "James Marsh, realizador de filmes como A Teoria de Tudo ou Homem no Arame, assumiu a missão de criar uma obra biográfica sobre Samue Beckett, figura ímpar da literatura e da dramaturgia do século XX. O guião foi escrito pelo escocês Neil Forsyth, vencedor de dois Baftas."
|
43 |
|
44 |
result = pipe([sentence])
|
45 |
|
46 |
print(f"{sentence}\n{result}")
|
47 |
|
48 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
```
|
50 |
|
51 |
## Acknowledgements
|