Update README.md
Browse files
README.md
CHANGED
@@ -25,6 +25,32 @@ Based on [Flair embeddings](https://aclanthology.org/C18-1139/)
|
|
25 |
|
26 |
# Usage
|
27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
[See our Google colab notebook](https://colab.research.google.com/drive/1Wz4ae5c65VDWanY3Vo-fj__bFjn-loL4?usp=sharing#scrollTo=2ZRSrcjuFMHO)
|
29 |
|
30 |
# Citation
|
|
|
25 |
|
26 |
# Usage
|
27 |
|
28 |
+
Requires: [Flair](https://github.com/flairNLP/flair/) (pip install flair)
|
29 |
+
|
30 |
+
```python
|
31 |
+
#import libraries
|
32 |
+
from flair.data import Sentence
|
33 |
+
from flair.models import SequenceTagger
|
34 |
+
|
35 |
+
# load the trained model
|
36 |
+
model = SequenceTagger.load("kalawinka/flair-ner-acknowledgments")
|
37 |
+
|
38 |
+
# create example sentence
|
39 |
+
sentence = Sentence("This work was supported by State Key Lab of Ocean Engineering Shanghai Jiao Tong University and financially supported by China National Scientific and Technology Major Project (Grant No. 2016ZX05028-006-009)")
|
40 |
+
|
41 |
+
# predict the tags
|
42 |
+
model.predict(sentence)
|
43 |
+
#print output as spans
|
44 |
+
for entity in sentence.get_spans('ner'):
|
45 |
+
print(entity)
|
46 |
+
```
|
47 |
+
|
48 |
+
This produces the following output:
|
49 |
+
|
50 |
+
```
|
51 |
+
|
52 |
+
```
|
53 |
+
|
54 |
[See our Google colab notebook](https://colab.research.google.com/drive/1Wz4ae5c65VDWanY3Vo-fj__bFjn-loL4?usp=sharing#scrollTo=2ZRSrcjuFMHO)
|
55 |
|
56 |
# Citation
|