

# IcelandicNER DistilBERT

This model was fine-tuned on the MIM-GOLD-NER dataset for the Icelandic language. 
The [MIM-GOLD-NER](http://hdl.handle.net/20.500.12537/42) corpus was developed at [Reykjavik University](https://en.ru.is/) in 2018–2020 that covered eight types of entities:

- Date
- Location
- Miscellaneous 
- Money
- Organization
- Percent
- Person
- Time 

## Dataset Information

|       |   Records |   B-Date |   B-Location |   B-Miscellaneous |   B-Money |   B-Organization |   B-Percent |   B-Person |   B-Time |   I-Date |   I-Location |   I-Miscellaneous |   I-Money |   I-Organization |   I-Percent |   I-Person |   I-Time |
|:------|----------:|---------:|-------------:|------------------:|----------:|-----------------:|------------:|-----------:|---------:|---------:|-------------:|------------------:|----------:|-----------------:|------------:|-----------:|---------:|
| Train |     39988 |     3409 |         5980 |              4351 |       729 |             5754 |         502 |      11719 |      868 |     2112 |          516 |              3036 |       770 |             2382 |          50 |       5478 |      790 |
| Valid |      7063 |      570 |         1034 |               787 |       100 |             1078 |         103 |       2106 |      147 |      409 |           76 |               560 |       104 |              458 |           7 |        998 |      136 |
| Test  |      8299 |      779 |         1319 |               935 |       153 |             1315 |         108 |       2247 |      172 |      483 |          104 |               660 |       167 |              617 |          10 |       1089 |      158 |


## Evaluation

The following tables summarize the scores obtained by model overall and per each class.

|     entity    | precision |  recall  | f1-score | support |
|:-------------:|:---------:|:--------:|:--------:|:-------:|
|      Date     |  0.969309 | 0.973042 | 0.971172 |  779.0  |
|    Location   |  0.941221 | 0.946929 | 0.944067 |  1319.0 |
| Miscellaneous |  0.848283 | 0.819251 | 0.833515 |  935.0  |
|     Money     |  0.928571 | 0.934641 | 0.931596 |  153.0  |
|  Organization |  0.874147 | 0.876806 | 0.875475 |  1315.0 |
|    Percent    |  1.000000 | 1.000000 | 1.000000 |  108.0  |
|     Person    |  0.956674 | 0.972853 | 0.964695 |  2247.0 |
|      Time     |  0.965318 | 0.970930 | 0.968116 |  172.0  |
|   micro avg   |  0.926110 | 0.929141 | 0.927623 |  7028.0 |
|   macro avg   |  0.935441 | 0.936807 | 0.936079 |  7028.0 |
|  weighted avg |  0.925578 | 0.929141 | 0.927301 |  7028.0 |


## How To Use
You use this model with Transformers pipeline for NER.

### Installing requirements

```bash
pip install transformers
```

### How to predict using pipeline

```python
from transformers import AutoTokenizer
from transformers import AutoModelForTokenClassification  # for pytorch
from transformers import TFAutoModelForTokenClassification  # for tensorflow
from transformers import pipeline


model_name_or_path = "m3hrdadfi/icelandic-ner-distilbert" 
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
model = AutoModelForTokenClassification.from_pretrained(model_name_or_path)  # Pytorch
# model = TFAutoModelForTokenClassification.from_pretrained(model_name_or_path)  # Tensorflow

nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "Kristin manneskja getur ekki lagt frásagnir af Jesú Kristi á hilluna vegna þess að hún sé búin að lesa þær ."

ner_results = nlp(example)
print(ner_results)
```


## Questions?
Post a Github issue on the [IcelandicNER Issues](https://github.com/m3hrdadfi/icelandic-ner/issues) repo.

{"language": "is", "license": "apache-2.0", "widget": [{"text": "Kristin manneskja getur ekki lagt fr\u00e1sagnir af Jes\u00fa Kristi \u00e1 hilluna vegna \u00feess a\u00f0 h\u00fan s\u00e9 b\u00fain a\u00f0 lesa \u00fe\u00e6r ."}, {"text": "Til hvers a\u00f0 kj\u00f3sa flokk , sem \u00feykist vera Jafna\u00f0armannaflokkur r\u00e9tt fyrir kosningar , \u00feegar a\u00f0 \u00fea\u00f0 er h\u00e6gt a\u00f0 kj\u00f3sa sannnan jafna\u00f0armannaflokk , sj\u00e1lfan Jafna\u00f0armannaflokk \u00cdslands - Samfylkinguna ."}, {"text": "\u00dea\u00f0 sanna\u00f0ist svo eftirminnilega \u00e1 pl\u00f6tunni \u00dea\u00f0 \u00fearf f\u00f3lk eins og \u00feig sem kom \u00fat fyrir \u00feremur \u00e1rum , en \u00e1 henni hann F\u00e1lka \u00far Keflav\u00edk og G\u00e1luna , son sinn , til a\u00f0 \u00fatsetja l\u00f6g hans og spila inn ."}, {"text": "L\u00f6gin hafa \u00e1\u00f0ur komi\u00f0 \u00fat sem aukal\u00f6g \u00e1 sm\u00e1sk\u00edfum af Hail to the Thief , en \u00e1 disknum er l\u00edka myndband og fleira efni fyrir t\u00f6lvur ."}, {"text": "Britney ger\u00f0i honum vi\u00f0vart og hann \u00f3k henni \u00e1 UCLA-sj\u00fakrah\u00fasi\u00f0 \u00ed Santa Monica en \u00fea\u00f0 er \u00ed n\u00e1grenni hlj\u00f3\u00f0versins ."}]}
transformers pytorch tf distilbert token-classification is license:apache-2.0 autotrain_compatible endpoints_compatible region:us
TAGS
#transformers #pytorch #tf #distilbert #token-classification #is #license-apache-2.0 #autotrain_compatible #endpoints_compatible #region-us 

IcelandicNER DistilBERT
=======================


This model was fine-tuned on the MIM-GOLD-NER dataset for the Icelandic language.
The MIM-GOLD-NER corpus was developed at Reykjavik University in 2018–2020 that covered eight types of entities:


* Date
* Location
* Miscellaneous
* Money
* Organization
* Percent
* Person
* Time


Dataset Information
-------------------



Evaluation
----------


The following tables summarize the scores obtained by model overall and per each class.



How To Use
----------


You use this model with Transformers pipeline for NER.


### Installing requirements


### How to predict using pipeline


Questions?
----------


Post a Github issue on the IcelandicNER Issues repo.



### Installing requirements ### How to predict using pipeline


Questions?
----------


Post a Github issue on the IcelandicNER Issues repo.
TAGS
#transformers #pytorch #tf #distilbert #token-classification #is #license-apache-2.0 #autotrain_compatible #endpoints_compatible #region-us 
 ### Installing requirements ### How to predict using pipeline


Questions?
----------


Post a Github issue on the IcelandicNER Issues repo.
TAGS
#transformers #pytorch #tf #distilbert #token-classification #is #license-apache-2.0 #autotrain_compatible #endpoints_compatible #region-us 
### Installing requirements### How to predict using pipeline


Questions?
----------


Post a Github issue on the IcelandicNER Issues repo.