add README.md
Browse files
README.md
CHANGED
@@ -31,6 +31,40 @@ CamemBERT-bio-gliner is a Named Entity Recognition (NER) model capable of identi
|
|
31 |
|
32 |
This is the v0.1 of the CamemBERT-bio-gliner model. There might be a few quirks or unexpected predictions. So, if you notice anything off or have suggestions for improvements, we'd really appreciate hearing from you!
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
## Links
|
36 |
|
|
|
31 |
|
32 |
This is the v0.1 of the CamemBERT-bio-gliner model. There might be a few quirks or unexpected predictions. So, if you notice anything off or have suggestions for improvements, we'd really appreciate hearing from you!
|
33 |
|
34 |
+
## Installation
|
35 |
+
To use this model, you must install the GLiNER Python library:
|
36 |
+
```
|
37 |
+
!pip install gliner
|
38 |
+
```
|
39 |
+
|
40 |
+
## Usage
|
41 |
+
Once you've downloaded the GLiNER library, you can import the GLiNER class. You can then load this model using `GLiNER.from_pretrained` and predict entities with `predict_entities`.
|
42 |
+
|
43 |
+
```python
|
44 |
+
from gliner import GLiNER
|
45 |
+
|
46 |
+
model = GLiNER.from_pretrained("almanach/camembert-bio-gliner-v0.1")
|
47 |
+
|
48 |
+
text = """
|
49 |
+
Mme A.P. âgée de 52 ans, non tabagique, ayant un diabète de type 2 a été hospitalisée pour une pneumopathie infectieuse. Cette patiente présentait depuis 2 ans des infections respiratoires traités en ambulatoire. L’examen physique a trouvé une fièvre à 38ºc et un foyer de râles crépitants de la base pulmonaire droite.
|
50 |
+
"""
|
51 |
+
|
52 |
+
labels = ["Âge", "Patient", "Maladie", "Symptômes"]
|
53 |
+
|
54 |
+
entities = model.predict_entities(text, labels, threshold=0.5, flat_ner=True)
|
55 |
+
|
56 |
+
for entity in entities:
|
57 |
+
print(entity["text"], "=>", entity["label"])
|
58 |
+
```
|
59 |
+
|
60 |
+
```bash
|
61 |
+
Mme A.P. => Patient
|
62 |
+
52 ans => Âge
|
63 |
+
pneumopathie infectieuse => Maladie
|
64 |
+
infections respiratoires => Maladie
|
65 |
+
fièvre => Symptômes
|
66 |
+
râles crépitants => Symptômes
|
67 |
+
```
|
68 |
|
69 |
## Links
|
70 |
|