Update README.md
Browse files
README.md
CHANGED
|
@@ -15,4 +15,36 @@ This model is designed for Named Entity Recognition (NER) tasks, specifically ta
|
|
| 15 |
## Try It Out
|
| 16 |
You can test the model directly in your browser through the following Hugging Face Spaces link: [https://huggingface.co/spaces/DeepMount00/universal_ner](https://huggingface.co/spaces/DeepMount00/universal_ner).
|
| 17 |
|
| 18 |
-
It's important to note that **this model is universal and operates across all domains**. However, if you are seeking performance metrics close to a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
## Try It Out
|
| 16 |
You can test the model directly in your browser through the following Hugging Face Spaces link: [https://huggingface.co/spaces/DeepMount00/universal_ner](https://huggingface.co/spaces/DeepMount00/universal_ner).
|
| 17 |
|
| 18 |
+
It's important to note that **this model is universal and operates across all domains**. However, if you are seeking performance metrics close to a 90/99% F1 score for a specific domain, you are encouraged to reach out via email to Michele Montebovi at montebovi.michele@gmail.com. This direct contact allows for the possibility of customizing the model to achieve enhanced performance tailored to your unique entity recognition requirements in the Italian language.
|
| 19 |
+
|
| 20 |
+
# Installation
|
| 21 |
+
To use this model, you must download the GLiNER repository and install its dependencies:
|
| 22 |
+
|
| 23 |
+
```
|
| 24 |
+
!git clone https://github.com/urchade/GLiNER.git
|
| 25 |
+
%cd GLiNER
|
| 26 |
+
!pip install -r requirements.txt
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
# Usage
|
| 30 |
+
Once you've downloaded the GLiNER repository, you can import the GLiNER class from the model file. You can then load this model using GLiNER.from_pretrained and predict entities with predict_entities.
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from model import GLiNER
|
| 34 |
+
|
| 35 |
+
model = GLiNER.from_pretrained("DeepMount00/universal_ner_ita")
|
| 36 |
+
|
| 37 |
+
text = """
|
| 38 |
+
Il comune di Castelrosso, con codice fiscale 80012345678, ha approvato il finanziamento di 15.000€ destinati alla ristrutturazione del parco giochi cittadino, affidando l'incarico alla società 'Verde Vivo Società Cooperativa', con sede legale in Corso della Libertà 45, Verona, da completarsi entro il 30/09/2024.
|
| 39 |
+
"""
|
| 40 |
+
|
| 41 |
+
labels = ["comune", "codice fiscale", "importo", "società", "indirizzo", "data di completamento"]
|
| 42 |
+
|
| 43 |
+
entities = model.predict_entities(text, labels)
|
| 44 |
+
|
| 45 |
+
max_length = max(len(entity["text"]) for entity in entities)
|
| 46 |
+
|
| 47 |
+
for entity in entities:
|
| 48 |
+
padded_text = entity["text"].ljust(max_length)
|
| 49 |
+
print(f"{padded_text} => {entity['label']}")
|
| 50 |
+
```
|