Views
No views yet
1from transformers import BertTokenizerFast, BertForTokenClassification
2from transformers import pipeline
3# Load model and tokenizer
4tokenizer = BertTokenizerFast.from_pretrained('buerokratt/{model_name}')
5model = BertForTokenClassification.from_pretrained('buerokratt/{model_name}')
6# Create NER pipeline
7nlp = pipeline("ner", model=model, tokenizer=tokenizer)
8# Example text
9text = ""
10# Get predictions
11ner_results = nlp(text)
12for entity in ner_results:
13 print(f"{entity['word']}: {entity['entity']}")| Metric | Score |
|---|---|
| Micro F1-Score | 0.8544 |
| Macro F1-Score | 0.8561 |
| Micro Precision | 0.8404 |
| Micro Recall | 0.8689 |
| Entity | Precision | Recall | F1-Score |
|---|---|---|---|
| GPE | 0.7778 | 0.7925 | 0.7850 |
| LOC | 0.9796 | 0.9412 | 0.9600 |
| ORG | 0.7778 | 0.8077 | 0.7925 |
| PER | 0.8393 | 0.9400 | 0.8868 |
1@misc{tanvir2020estbert,
2 title={EstBERT: A Pretrained Language-Specific BERT for Estonian},
3 author={Hasan Tanvir and Claudia Kittask and Kairit Sirts},
4 year={2020},
5 eprint={2011.04784},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL}
8}