Update README.md
#1
by elisabetconese - opened
README.md
CHANGED
|
@@ -38,6 +38,28 @@ language:
|
|
| 38 |
|
| 39 |
**Headline Metric:** Entity-level F1 = **0.9315**
|
| 40 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
## Limitations
|
| 42 |
|
| 43 |
* English-only.
|
|
|
|
| 38 |
|
| 39 |
**Headline Metric:** Entity-level F1 = **0.9315**
|
| 40 |
|
| 41 |
+
## Exaple Usage
|
| 42 |
+
```python
|
| 43 |
+
from transformers import pipeline
|
| 44 |
+
|
| 45 |
+
# 1. Initialize the NER pipeline
|
| 46 |
+
ner = pipeline(
|
| 47 |
+
task="token-classification",
|
| 48 |
+
model="Elpapudex/Ner-full",
|
| 49 |
+
aggregation_strategy="simple" # Groups sub-tokens into complete entity names
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# 2. Text to test
|
| 53 |
+
text = "Sundar Pichai announced that Google is opening a new AI hub in London next October."
|
| 54 |
+
|
| 55 |
+
# 3. Run inference
|
| 56 |
+
results = ner(text)
|
| 57 |
+
|
| 58 |
+
# 4. Display detected entities
|
| 59 |
+
for entity in results:
|
| 60 |
+
print(f"Entity: {entity['word']} | Label: {entity['entity_group']} | Confidence: {entity['score']:.2%}")
|
| 61 |
+
```
|
| 62 |
+
|
| 63 |
## Limitations
|
| 64 |
|
| 65 |
* English-only.
|