Add usage details
Browse files
README.md
CHANGED
@@ -20,7 +20,66 @@ model-index:
|
|
20 |
- name: NER F Score
|
21 |
type: f_score
|
22 |
value: 0.9899159664
|
|
|
23 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
| Feature | Description |
|
25 |
| --- | --- |
|
26 |
| **Name** | `en_spacy_medication_ner` |
|
@@ -30,8 +89,8 @@ model-index:
|
|
30 |
| **Components** | `tok2vec`, `ner` |
|
31 |
| **Vectors** | 0 keys, 0 unique vectors (0 dimensions) |
|
32 |
| **Sources** | n/a |
|
33 |
-
| **License** |
|
34 |
-
| **Author** | [
|
35 |
|
36 |
### Label Scheme
|
37 |
|
|
|
20 |
- name: NER F Score
|
21 |
type: f_score
|
22 |
value: 0.9899159664
|
23 |
+
license: mit
|
24 |
---
|
25 |
+
### Details: https://github.com/JackLeeJM/slm-medication-ner
|
26 |
+
|
27 |
+
### Usage
|
28 |
+
|
29 |
+
1. Install using PIP:
|
30 |
+
```bash
|
31 |
+
!pip install "en_spacy_medication_ner @ https://huggingface.co/jackleejm/en_spacy_medication_ner/resolve/main/en_spacy_medication_ner-any-py3-none-any.whl"
|
32 |
+
```
|
33 |
+
2. Load model:
|
34 |
+
```python
|
35 |
+
import spacy
|
36 |
+
|
37 |
+
nlp = spacy.load("en_spacy_medication_ner")
|
38 |
+
```
|
39 |
+
3. Run inferences:
|
40 |
+
```python
|
41 |
+
input = ["Acetaminophen 325 MG Oral Tablet"]
|
42 |
+
docs = list(nlp.pipe(input))
|
43 |
+
results = [
|
44 |
+
[
|
45 |
+
{
|
46 |
+
"word": ent.text,
|
47 |
+
"entity_group": ent.label_,
|
48 |
+
"start": ent.start_char,
|
49 |
+
"end": ent.end_char,
|
50 |
+
}
|
51 |
+
for ent in doc.ents
|
52 |
+
]
|
53 |
+
for doc in docs
|
54 |
+
]
|
55 |
+
|
56 |
+
print(results)
|
57 |
+
|
58 |
+
# Outputs
|
59 |
+
[
|
60 |
+
[
|
61 |
+
{
|
62 |
+
"word": "Acetaminophen",
|
63 |
+
"entity_group": "DRUG",
|
64 |
+
"start": 0,
|
65 |
+
"end": 13
|
66 |
+
},
|
67 |
+
{
|
68 |
+
"word": "325 MG",
|
69 |
+
"entity_group": "DOSAGE",
|
70 |
+
"start": 14,
|
71 |
+
"end": 20
|
72 |
+
},
|
73 |
+
{
|
74 |
+
"word": "Oral Tablet",
|
75 |
+
"entity_group": "ROUTE",
|
76 |
+
"start": 21,
|
77 |
+
"end": 32
|
78 |
+
}
|
79 |
+
]
|
80 |
+
]
|
81 |
+
```
|
82 |
+
|
83 |
| Feature | Description |
|
84 |
| --- | --- |
|
85 |
| **Name** | `en_spacy_medication_ner` |
|
|
|
89 |
| **Components** | `tok2vec`, `ner` |
|
90 |
| **Vectors** | 0 keys, 0 unique vectors (0 dimensions) |
|
91 |
| **Sources** | n/a |
|
92 |
+
| **License** | MIT |
|
93 |
+
| **Author** | [JackLeeJM](https://github.com/JackLeeJM) |
|
94 |
|
95 |
### Label Scheme
|
96 |
|