Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: afl-3.0
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
tags:
|
| 3 |
+
- flair
|
| 4 |
+
- token-classification
|
| 5 |
+
- sequence-tagger-model
|
| 6 |
+
language: en
|
| 7 |
+
datasets:
|
| 8 |
+
- conll2003
|
| 9 |
license: afl-3.0
|
| 10 |
---
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
| 14 |
+
|
| 15 |
+
```python
|
| 16 |
+
from flair.data import Sentence
|
| 17 |
+
from flair.models import SequenceTagger
|
| 18 |
+
# load tagger
|
| 19 |
+
tagger = SequenceTagger.load("Saisam/Inquirer_ner")
|
| 20 |
+
# make example sentence
|
| 21 |
+
sentence = Sentence("George Washington went to Washington")
|
| 22 |
+
# predict NER tags
|
| 23 |
+
tagger.predict(sentence)
|
| 24 |
+
# print sentence
|
| 25 |
+
print(sentence)
|
| 26 |
+
# print predicted NER spans
|
| 27 |
+
print('The following NER tags are found:')
|
| 28 |
+
# iterate over entities and print
|
| 29 |
+
for entity in sentence.get_spans('ner'):
|
| 30 |
+
print(entity)
|
| 31 |
+
```
|