Add my first flair model
Browse files- README.md +26 -0
- pytorch_model.bin +3 -0
README.md
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- flair
|
4 |
+
- token-classification
|
5 |
+
- sequence-tagger-model
|
6 |
+
---
|
7 |
+
### Demo: How to use in Flair
|
8 |
+
Requires:
|
9 |
+
- **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
10 |
+
```python
|
11 |
+
from flair.data import Sentence
|
12 |
+
from flair.models import SequenceTagger
|
13 |
+
# load tagger
|
14 |
+
tagger = SequenceTagger.load("GuiGel/meddocan-flair-lstm-crf")
|
15 |
+
# make example sentence
|
16 |
+
sentence = Sentence("On September 1st George won 1 dollar while watching Game of Thrones.")
|
17 |
+
# predict NER tags
|
18 |
+
tagger.predict(sentence)
|
19 |
+
# print sentence
|
20 |
+
print(sentence)
|
21 |
+
# print predicted NER spans
|
22 |
+
print('The following NER tags are found:')
|
23 |
+
# iterate over entities and print
|
24 |
+
for entity in sentence.get_spans('ner'):
|
25 |
+
print(entity)
|
26 |
+
```
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e96144635816ca6b8be9b3ca23e593856b8c6daa13127b70b18262ccb597ac6d
|
3 |
+
size 255000956
|