Token Classification
GLiNER
PyTorch
Safetensors
Erik Novak
Update README.md
f6fb544 verified
|
raw
history blame
4.52 kB
---
license: apache-2.0
language:
- en
- fr
- de
- es
- pt
- it
- sl
- el
- nl
library_name: gliner
pipeline_tag: token-classification
---
# Model Card for GLiNER PII Domains
GLiNER is a Named Entity Recognition (NER) model capable of identifying any entity type using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to traditional NER models, which are limited to predefined entities, and Large Language Models (LLMs) that, despite their flexibility, are costly and large for resource-constrained scenarios.
This model has been trained by fine-tuning `urchade/gliner_multi_pii-v1` on the synthetic dataset covering PPIs for the domains: `healthcare`, `finance`, `legal`, `banking` and `general`.
This model is capable of recognizing various types of *personally identifiable information* (PII), including but not limited to these entity types: `person`, `organization`, `phone number`, `address`, `passport number`, `email`, `credit card number`, `social security number`, `health insurance id number`, `date of birth`, `mobile phone number`, `bank account number`, `medication`, `cpf`, `driver's license number`, `tax identification number`, `medical condition`, `identity card number`, `national id number`, `ip address`, `email address`, `iban`, `credit card expiration date`, `username`, `health insurance number`, `registration number`, `student id number`, `insurance number`, `flight number`, `landline phone number`, `blood type`, `cvv`, `reservation number`, `digital signature`, `social media handle`, `license plate number`, `cnpj`, `postal code`, `passport number`, `serial number`, `vehicle registration number`, `credit card brand`, `fax number`, `visa number`, `insurance company`, `identity document number`, `transaction number`, `national health insurance number`, `cvc`, `birth certificate number`, `train ticket number`, `passport expiration date`, and `social security number`.
## English example
```python
text = """
Medical Record
Patient Name: John Doe
Date of Birth: 15-01-1985
Date of Examination: 20-05-2024
Social Security Number: 123-45-6789
Examination Procedure:
John Doe underwent a routine physical examination. The procedure included measuring vital signs (blood pressure, heart rate, temperature), a comprehensive blood panel, and a cardiovascular stress test. The patient also reported occasional headaches and dizziness, prompting a neurological assessment and an MRI scan to rule out any underlying issues.
Medication Prescribed:
Ibuprofen 200 mg: Take one tablet every 6-8 hours as needed for headache and pain relief.
Lisinopril 10 mg: Take one tablet daily to manage high blood pressure.
Next Examination Date:
15-11-2024
"""
# Labels for entity prediction
labels = ["name", "social security number", "date of birth", "date"]
# Perform entity prediction
entities = trained_model.predict_entities(text, labels, threshold=0.5)
# Display predicted entities and their labels
for entity in entities:
print(entity["text"], "=>", entity["label"])
```
```text
John Doe => name
15-01-1985 => date of birth
20-05-2024 => date
123-45-6789 => social security number
John Doe => name
15-11-2024 => date
```
## Dutch example
```python
text = """
Medisch dossier
Naam patiënt: Jan de Vries
Geboortedatum: 15-01-1985
Datum van onderzoek: 20-05-2024
Burgerservicenummer: 987-65-4321
Onderzoeksprocedure:
Jan de Vries onderging een routine lichamelijk onderzoek. De procedure omvatte het meten van de vitale functies (bloeddruk, hartslag, temperatuur), een uitgebreid bloedonderzoek en een cardiovasculaire inspanningstest. De patiënt meldde ook af en toe hoofdpijn en duizeligheid, wat aanleiding gaf tot een neurologische beoordeling en een MRI-scan om eventuele onderliggende problemen uit te sluiten.
Voorgeschreven medicatie:
Paracetamol 500 mg: Neem één tablet elke 6-8 uur indien nodig voor hoofdpijn en pijnverlichting.
Amlodipine 5 mg: Neem één tablet dagelijks om hoge bloeddruk te beheersen.
Volgende onderzoekdatum:
15-11-2024
"""
# Labels for entity prediction
labels = ["naam", "bmurgerservicenummer", "geboortedatum", "datum"]
# Perform entity prediction
entities = trained_model.predict_entities(text, labels, threshold=0.2)
# Display predicted entities and their labels
for entity in entities:
print(entity["text"], "=>", entity["label"])
```
```text
Jan de Vries => naam
15-01-1985 => geboortedatum
20-05-2024 => datum
987-65-4321 => bmurgerservicenummer
Jan de Vries => naam
15-11-2024 => datum
```