Adding flair swe ner model
Browse files- README.md +55 -0
- pytorch_model.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- flair
|
| 4 |
+
- token-classification
|
| 5 |
+
- sequence-tagger-model
|
| 6 |
+
language: sv
|
| 7 |
+
datasets:
|
| 8 |
+
- SUC 3.0
|
| 9 |
+
widget:
|
| 10 |
+
- text: "Hampus Londögård bor i Lund och har levererat denna model idag."
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
## Swedish NER in Flair (SUC 3.0)
|
| 14 |
+
F1-Score: **85.6** (SUC 3.0)
|
| 15 |
+
B-PRS, I-PRS, B-ORG, I-ORG, B-TME, I-TME, B-WRK, B-LOC, I-LOC, B-EVN, I-EVN, B-MSR, I-MSR, I-WRK, B-OBJ, I-OBJ
|
| 16 |
+
Predicts 8 tags:
|
| 17 |
+
| **tag** | **meaning** |
|
| 18 |
+
|---------------------------------|-----------|
|
| 19 |
+
| PRS| cardinal value |
|
| 20 |
+
| ORG | organisation name|
|
| 21 |
+
| TME | time unit |
|
| 22 |
+
| WRK | building name |
|
| 23 |
+
| LOC | location name |
|
| 24 |
+
| EVN | event name |
|
| 25 |
+
| MSR | measurement unit |
|
| 26 |
+
| OBJ | object |
|
| 27 |
+
|
| 28 |
+
Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and LSTM-CRF.
|
| 29 |
+
---
|
| 30 |
+
### Demo: How to use in Flair
|
| 31 |
+
Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
| 32 |
+
```python
|
| 33 |
+
from flair.data import Sentence
|
| 34 |
+
from flair.models import SequenceTagger
|
| 35 |
+
# load tagger
|
| 36 |
+
tagger = SequenceTagger.load("flair/ner-english-ontonotes-large")
|
| 37 |
+
# make example sentence
|
| 38 |
+
sentence = Sentence(<Insert Text>)
|
| 39 |
+
# predict NER tags
|
| 40 |
+
tagger.predict(sentence)
|
| 41 |
+
# print sentence
|
| 42 |
+
print(sentence)
|
| 43 |
+
# print predicted NER spans
|
| 44 |
+
print('The following NER tags are found:')
|
| 45 |
+
# iterate over entities and print
|
| 46 |
+
for entity in sentence.get_spans('ner'):
|
| 47 |
+
print(entity)
|
| 48 |
+
```
|
| 49 |
+
This yields the following output:
|
| 50 |
+
```
|
| 51 |
+
TODO()
|
| 52 |
+
```
|
| 53 |
+
So, the entities "*TODO*" (labeled as a **EVT**), are found in the sentence "TODO".
|
| 54 |
+
---
|
| 55 |
+
Please mention londogard if using this models.
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bf20d87ad5710aa5e68a297b0dad9db8f552632e549ed3d025bdbc8600922087
|
| 3 |
+
size 351555629
|