Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
pipeline_tag: token-classification
|
3 |
+
tags:
|
4 |
+
- named-entity-recognition
|
5 |
+
- sequence-tagger-model
|
6 |
+
widget:
|
7 |
+
- text: "Numele meu este Amadeus Wolfgang și locuiesc în Berlin"
|
8 |
+
inference:
|
9 |
+
parameters:
|
10 |
+
aggregation_strategy: "simple"
|
11 |
+
grouped_entities: true
|
12 |
+
language:
|
13 |
+
- nl
|
14 |
+
---
|
15 |
+
|
16 |
+
xlm-roberta model trained on ronec, performing 95 f1-Macro on test set.
|
17 |
+
|
18 |
+
|
19 |
+
```python
|
20 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
21 |
+
from transformers import pipeline
|
22 |
+
|
23 |
+
tokenizer = AutoTokenizer.from_pretrained("EvanD/xlm-roberta-base-romanian-ner-ronec")
|
24 |
+
ner_model = AutoModelForTokenClassification.from_pretrained("EvanD/xlm-roberta-base-romanian-ner-ronec")
|
25 |
+
|
26 |
+
nlp = pipeline("ner", model=ner_model, tokenizer=tokenizer, aggregation_strategy="simple")
|
27 |
+
example = "Numele meu este Amadeus Wolfgang și locuiesc în Berlin"
|
28 |
+
|
29 |
+
ner_results = nlp(example)
|
30 |
+
print(ner_results)
|
31 |
+
|
32 |
+
# [
|
33 |
+
# {
|
34 |
+
# 'entity_group': 'PER',
|
35 |
+
# 'score': 0.9966806,
|
36 |
+
# 'word': 'Amadeus Wolfgang',
|
37 |
+
# 'start': 16,
|
38 |
+
# 'end': 32
|
39 |
+
# },
|
40 |
+
# {'entity_group': 'GPE',
|
41 |
+
# 'score': 0.99694663,
|
42 |
+
# 'word': 'Berlin',
|
43 |
+
# 'start': 48,
|
44 |
+
# 'end': 54
|
45 |
+
# }
|
46 |
+
# ]
|
47 |
+
```
|