Update README.md
Browse files
README.md
CHANGED
@@ -8,4 +8,32 @@ datasets:
|
|
8 |
- conll2003
|
9 |
widget:
|
10 |
- text: "George Washington went to Washington"
|
11 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
- conll2003
|
9 |
widget:
|
10 |
- text: "George Washington went to Washington"
|
11 |
+
---
|
12 |
+
|
13 |
+
```python
|
14 |
+
from flair.data import Sentence
|
15 |
+
from flair.models import SequenceTagger
|
16 |
+
# load tagger
|
17 |
+
tagger = SequenceTagger.load("Saisam/Inquirer_ner_loc")
|
18 |
+
# make example sentence
|
19 |
+
sentence = Sentence("George Washington went to Washington")
|
20 |
+
# predict NER tags
|
21 |
+
tagger.predict(sentence)
|
22 |
+
# print sentence
|
23 |
+
print(sentence)
|
24 |
+
# print predicted NER spans
|
25 |
+
print('The following NER tags are found:')
|
26 |
+
# iterate over entities and print
|
27 |
+
for entity in sentence.get_spans('ner'):
|
28 |
+
print(entity)
|
29 |
+
```
|
30 |
+
|
31 |
+
|
32 |
+
```
|
33 |
+
@inproceedings{akbik2018coling,
|
34 |
+
title={Contextual String Embeddings for Sequence Labeling},
|
35 |
+
author={Akbik, Alan and Blythe, Duncan and Vollgraf, Roland},
|
36 |
+
booktitle = {{COLING} 2018, 27th International Conference on Computational Linguistics},
|
37 |
+
pages = {1638--1649},
|
38 |
+
year = {2018}
|
39 |
+
}
|