Update README.md
Browse files
README.md
CHANGED
@@ -14,3 +14,24 @@ metrics:
|
|
14 |
widget:
|
15 |
- text: "Jean Paul Gaultier Classique - 50 ML Eau de Parfum Damen Parfum"
|
16 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
widget:
|
15 |
- text: "Jean Paul Gaultier Classique - 50 ML Eau de Parfum Damen Parfum"
|
16 |
---
|
17 |
+
|
18 |
+
### Demo: How to use in Flair
|
19 |
+
Requires:
|
20 |
+
- **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
|
21 |
+
```python
|
22 |
+
from flair.data import Sentence
|
23 |
+
from flair.models import SequenceTagger
|
24 |
+
# load tagger
|
25 |
+
tagger = SequenceTagger.load("{repo_id}")
|
26 |
+
# make example sentence
|
27 |
+
sentence = Sentence("Jean Paul Gaultier Classique - 50 ML Eau de Parfum Damen Parfum.")
|
28 |
+
# predict NER tags
|
29 |
+
tagger.predict(sentence)
|
30 |
+
# print sentence
|
31 |
+
print(sentence)
|
32 |
+
# print predicted NER spans
|
33 |
+
print('The following NER tags are found:')
|
34 |
+
# iterate over entities and print
|
35 |
+
for entity in sentence.get_spans('ner'):
|
36 |
+
print(entity)
|
37 |
+
```"""
|