hdpsantos commited on
Commit
6484741
1 Parent(s): 5f3fdae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md CHANGED
@@ -13,6 +13,31 @@ widget:
13
 
14
  The [NoHarm-Anony - De-Identification of Clinical Notes Using Contextualized Language Models and a Token Classifier](https://link.springer.com/chapter/10.1007/978-3-030-91699-2_3) paper contains Flair-based models for Portuguese Language, initialized with [Flair BBP](https://github.com/jneto04/ner-pt) & trained on clinical notes with names tagged.
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  ## More Information
17
 
18
  Refer to the original paper, [De-Identification of Clinical Notes Using Contextualized Language Models and a Token Classifier](https://link.springer.com/chapter/10.1007/978-3-030-91699-2_3) for additional details and performance.
 
13
 
14
  The [NoHarm-Anony - De-Identification of Clinical Notes Using Contextualized Language Models and a Token Classifier](https://link.springer.com/chapter/10.1007/978-3-030-91699-2_3) paper contains Flair-based models for Portuguese Language, initialized with [Flair BBP](https://github.com/jneto04/ner-pt) & trained on clinical notes with names tagged.
15
 
16
+ ### Demo: How to use in Flair
17
+
18
+ Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
19
+
20
+ ```python
21
+ from flair.data import Sentence
22
+ from flair.models import SequenceTagger
23
+ # load tagger
24
+ tagger = SequenceTagger.load("noharm-ai/anony")
25
+ # make example sentence
26
+ sentence = Sentence("FISIOTERAPIA TRAUMATO - MANHÃ Henrique Dias, 38 anos. Exercícios metabólicos de extremidades inferiores. Realizo mobilização patelar e leve mobilização de flexão de joelho conforme liberado pelo Dr Marcelo Arocha. Oriento cuidados e posicionamentos.")
27
+ # predict NER tags
28
+ tagger.predict(sentence)
29
+ # print sentence
30
+ print(sentence)
31
+ # print predicted NER spans
32
+ print('The following NER tags are found:')
33
+ # iterate over entities and print
34
+ for entity in sentence.get_spans('ner'):
35
+ print(entity)
36
+ ```
37
+
38
+
39
+
40
+
41
  ## More Information
42
 
43
  Refer to the original paper, [De-Identification of Clinical Notes Using Contextualized Language Models and a Token Classifier](https://link.springer.com/chapter/10.1007/978-3-030-91699-2_3) for additional details and performance.