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