Views
No views yet
knowledgator/gliner-bi-base-v1.0, specifically trained for the detection of Personally Identifiable Information (PII) and Protected Health Information (PHI).
Gretel GLiNER helps to provide privacy-compliant entity recognition across various industries and document types.
For more information about the base GLiNER model, including its architecture and general capabilities, please refer to the GLiNER Model Card.gretelai/gretel-pii-masking-en-v1 dataset, which provides a rich and diverse collection of synthetic document snippets containing PII and PHI entities.| Model | Accuracy | Precision | Recall | F1 Score |
|---|---|---|---|---|
| gretelai/gretel-gliner-bi-small-v1.0 | 0.89 | 0.98 | 0.91 | 0.94 |
| gretelai/gretel-gliner-bi-base-v1.0 | 0.91 | 0.98 | 0.92 | 0.95 |
| gretelai/gretel-gliner-bi-large-v1.0 | 0.91 | 0.99 | 0.93 | 0.95 |
gliner package:pip install gliner -U1from gliner import GLiNER
2
3# Load the fine-tuned GLiNER model
4model = GLiNER.from_pretrained("gretelai/gretel-gliner-bi-base-v1.0")
5
6# Sample text containing PII/PHI entities
7text = """
8Purchase Order
9----------------
10Date: 10/05/2023
11----------------
12Customer Name: CID-982305
13Billing Address: 1234 Oak Street, Suite 400, Springfield, IL, 62704
14Phone: (312) 555-7890 (555-876-5432)
15Email: janedoe@company.com
16"""
17
18# Define the labels for PII/PHI entities
19labels = [
20 "medical_record_number",
21 "date_of_birth",
22 "ssn",
23 "date",
24 "first_name",
25 "email",
26 "last_name",
27 "customer_id",
28 "employee_id",
29 "name",
30 "street_address",
31 "phone_number",
32 "ipv4",
33 "credit_card_number",
34 "license_plate",
35 "address",
36 "user_name",
37 "device_identifier",
38 "bank_routing_number",
39 "date_time",
40 "company_name",
41 "unique_identifier",
42 "biometric_identifier",
43 "account_number",
44 "city",
45 "certificate_license_number",
46 "time",
47 "postcode",
48 "vehicle_identifier",
49 "coordinate",
50 "country",
51 "api_key",
52 "ipv6",
53 "password",
54 "health_plan_beneficiary_number",
55 "national_id",
56 "tax_id",
57 "url",
58 "state",
59 "swift_bic",
60 "cvv",
61 "pin"
62]
63
64# Predict entities with a confidence threshold of 0.7
65entities = model.predict_entities(text, labels, threshold=0.7)
66
67# Display the detected entities
68for entity in entities:
69 print(f"{entity['text']} => {entity['label']}")CID-982305 => customer_id
1234 Oak Street, Suite 400 => street_address
Springfield => city
IL => state
62704 => postcode
(312) 555-7890 => phone_number
555-876-5432 => phone_number
janedoe@company.com => email1@dataset{gretel-pii-masking-en-v1,
2 author = {Gretel AI},
3 title = {GLiNER Models for PII Detection through Fine-Tuning on Gretel-Generated Synthetic Documents},
4 year = {2024},
5 month = {10},
6 publisher = {Gretel},
7 howpublished = {https://huggingface.co/gretelai/gretel-pii-masking-en-v1}
8}