File size: 6,803 Bytes
2052511 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee 2cda9a8 4cf5cee 2cda9a8 d8aff75 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee d8aff75 4cf5cee 2cda9a8 2052511 d8aff75 9695aab d8aff75 2cda9a8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
---
base_model:
- pierreguillou/ner-bert-large-cased-pt-lenerbr
datasets:
- carolina-c4ai/corpus-carolina
language:
- pt
metrics:
- precision
- recall
- f1
- accuracy
tags:
- generated_from_trainer
- legal
widget:
- text: >-
Falsificação de documento público, uso de documento falso. Anotação de
Responsabilidade Técnica Nº 1055330634101 de 12 de janeiro de 2013 relativa
à Lei Federal Nº 531. Trata-se de representação referente a possível
falsificação documentação técnica registrada pelo CREA-SP, feita pelo senhor
Francis Pantele da Cozzi, CPF: 412.612.341-32, telefone (31) 951358433,
email [email protected], atinente à sua contratação pela senhora Marinalva Bete
Raz, CPF: 049.567.041-22, telefone (61) 9412 3333, mulher branca, opinião
política conservadora, religião evangélica. Marinalva Bete Raz reclama por
indenização por danos morais no dia 14.05.2013 no valor de R$ 82.662,00
(Oitenta e dois mil, seiscentos e sessenta e dois reais) relacionado ao
endereço IP 192.168.01 e ao endereço constante no CEP 59123-222, Rua dos
Pioneiros, nº 450, Jardim Esmeralda, Campo Grande, MS. Ela afirma que
precisa deste dinheiro o mais rápido possível, já que sua saúde está
comprometida, pois sofre de asma. A parte Francis Pantele da Cozzi afirma
que apenas possui 5.534,00 reais como patrimônio e precisa do dinheiro para
sustentar seu filho menor de idade chamado Josué Vittas.
model-index:
- name: checkpoints
results:
- task:
type: token-classification
name: Token Classification
dataset:
name: carolina-c4ai/corpus-carolina
type: carolina-c4ai/corpus-carolina
metrics:
- type: f1
value: 0.9470445768148197
name: F1
- type: precision
value: 0.9544794827813696
name: Precision
- type: recall
value: 0.9191397849462366
name: Recall
- type: accuracy
value: 0.9470445768148197
name: Accuracy
- type: loss
value: 0.939724603793193
name: Loss
pipeline_tag: token-classification
---
## NER model in the legal domain in Portuguese according to LGPD (Brazilian Law for Data Protection)
**legal-bert-lgpd** is a NER model (token classification) in the legal domain in Portuguese that classifies the tokens into the following classes:
| Labels |
| -------- |
| NOME |
| DATA |
| ENDERECO |
| CEP |
| CPF |
| TELEFONE |
| EMAIL |
| DINHEIRO |
## Usage
```python
import torch
from transformers import pipeline, AutoTokenizer
MODEL_NAME = "celiudos/legal-bert-lgpd"
tokenizer = AutoTokenizer.from_pretrained(
MODEL_NAME,
model_max_length=512,
)
pipe = pipeline(
"ner",
tokenizer=tokenizer,
model=MODEL_NAME,
stride=100,
aggregation_strategy="first",
device=0 if torch.cuda.is_available() else -1,
)
pipe(
"Anotação de Responsabilidade Técnica Nº 1055330634101 de 12 de janeiro de 2013 relativa à Lei Federal Nº 531. Trata-se de representação referente a possível falsificação documentação técnica registrada pelo CREA-SP, feita pelo senhor Francis Pantele da Cozzi, CPF: 412.612.341-32, telefone (31) 951358433, email [email protected], atinente à sua contratação pela senhora Marinalva Bete Raz, CPF: 049.567.041-22, telefone (61) 9412 3333, mulher branca, opinião política conservadora, religião evangélica. Marinalva Bete Raz reclama por indenização por danos morais no dia 14.05.2013 no valor de R$ 82.662,00 (Oitenta e dois mil, seiscentos e sessenta e dois reais) relacionado ao endereço IP 192.168.01 e ao endereço constante no CEP 59123-222, Rua dos Pioneiros, nº 450, Jardim Esmeralda, Campo Grande, MS."
)
```
Output
```json
[
{
"entity_group": "DATA",
"score": 0.9828296,
"word": "12 de janeiro de 2013",
"start": 57,
"end": 78
},
{
"entity_group": "NOME",
"score": 0.95766664,
"word": "Francis Pantele da Cozzi",
"start": 234,
"end": 258
},
{
"entity_group": "CPF",
"score": 0.9954297,
"word": "412. 612. 341 - 32",
"start": 265,
"end": 279
},
{
"entity_group": "TELEFONE",
"score": 0.5634508,
"word": "31 )",
"start": 291,
"end": 294
},
{
"entity_group": "EMAIL",
"score": 0.9973985,
"word": "fran @ bol. com",
"start": 312,
"end": 324
},
{
"entity_group": "NOME",
"score": 0.96683884,
"word": "Marinalva Bete Raz",
"start": 366,
"end": 384
},
{
"entity_group": "CPF",
"score": 0.99713326,
"word": "049. 567. 041 - 22",
"start": 391,
"end": 405
},
{
"entity_group": "TELEFONE",
"score": 0.90854883,
"word": "( 61 ) 9412 3333",
"start": 416,
"end": 430
},
{
"entity_group": "NOME",
"score": 0.9364093,
"word": "Marinalva Bete Raz",
"start": 499,
"end": 517
},
{
"entity_group": "DATA",
"score": 0.9986375,
"word": "14",
"start": 566,
"end": 568
},
{
"entity_group": "DATA",
"score": 0.9968226,
"word": "05",
"start": 569,
"end": 571
},
{
"entity_group": "DATA",
"score": 0.9992943,
"word": "2013",
"start": 572,
"end": 576
},
{
"entity_group": "DINHEIRO",
"score": 0.99847966,
"word": "R $ 82. 662, 00",
"start": 589,
"end": 601
},
{
"entity_group": "CEP",
"score": 0.9977593,
"word": "59123 - 222",
"start": 728,
"end": 737
},
{
"entity_group": "ENDERECO",
"score": 0.9711078,
"word": "Rua dos Pioneiros",
"start": 739,
"end": 756
},
{
"entity_group": "ENDERECO",
"score": 0.9741938,
"word": "Jardim Esmeralda",
"start": 766,
"end": 782
},
{
"entity_group": "ENDERECO",
"score": 0.9352198,
"word": "Campo Grande, MS",
"start": 784,
"end": 800
}
]
```
### Custom Input Usage
```python
import gradio as gr
def ner(text):
return {"text": text, "entities": pipe(text)}
gr.Interface(
ner,
gr.Textbox(placeholder="Enter sentence here..."),
gr.HighlightedText(),
live=True,
examples=[
"Anotação de Responsabilidade Técnica Nº 1055330634101 de 12 de janeiro de 2013 relativa à Lei Federal Nº 531. Trata-se de representação referente a possível falsificação documentação técnica registrada pelo CREA-SP, feita pelo senhor Francis Pantele da Cozzi, CPF: 412.612.341-32, telefone (31) 951358433, email [email protected].",
],
).launch()
```
## Train Configuration
```python
Num examples = 3,971
Num Epochs = 5
Instantaneous batch size per device = 16
Total train batch size (w. parallel, distributed & accumulation) = 16
Gradient Accumulation steps = 1
Total optimization steps = 1,245
Number of trainable parameters = 333,364,241
``` |