From 12c6390317180fde8dd6178545212cdf96bd24b3 Mon Sep 17 00:00:00 2001 From: Nacim Date: Mon, 23 Jun 2025 23:29:34 +0200 Subject: [PATCH] Update default.yaml --- conf/default.yaml | 115 ++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 13 deletions(-) diff --git a/conf/default.yaml b/conf/default.yaml index 3f059c9..ae171e6 100644 --- a/conf/default.yaml +++ b/conf/default.yaml @@ -1,5 +1,5 @@ # ===================================================================== -# CONFIGURATION PRESIDIO - v8 (NETTOYÉE ET FIABLE) +# CONFIGURATION PRESIDIO - v11 (MAXIMALE FR/BE) # ===================================================================== supported_languages: [en, fr] @@ -11,6 +11,7 @@ nlp_configuration: - lang_code: en model_name: en_core_web_lg - lang_code: fr + # Utilisation du modèle le plus large et le plus précis model_name: fr_core_news_lg ner_model_configuration: labels_to_ignore: @@ -24,12 +25,12 @@ nlp_configuration: - PRODUCT - QUANTITY - WORK_OF_ART + # Seuils de confiance affinés pour une meilleure détection confidence_thresholds: DEFAULT_CONFIDENCE: 0.65 PERSON: 0.85 - LOCATION: 0.4 - DATE_TIME: 0.4 - ORGANIZATION: 0.7 + LOCATION: 0.35 + ORGANIZATION: 0.4 # 2. CONFIGURATION DU REGISTRE DES DÉTECTEURS # ===================================================================== @@ -37,8 +38,7 @@ recognizer_registry: load_predefined_recognizers: true recognizers: - # --- DÉTECTEURS FIABLES ET PRÉCIS UNIQUEMENT --- - + # --- DÉTECTEURS FONDAMENTAUX --- - name: CustomDateRecognizer supported_language: fr supported_entity: CUSTOM_DATE @@ -46,20 +46,35 @@ recognizer_registry: - name: Date DD/MM/YYYY regex: "\\b(0[1-9]|[12][0-9]|3[01])[-/.](0[1-9]|1[012])[-/.](19|20)\\d{2}\\b" score: 1.0 - context: ["date"] - + context: ["date de naissance"] - name: EmailRecognizer supported_language: fr supported_entity: EMAIL_ADDRESS patterns: [{name: Email Pattern, regex: "\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b", score: 1.0}] context: ["email", "courriel", "mail"] - - name: PhoneRecognizer supported_language: fr supported_entity: PHONE_NUMBER patterns: [{name: Phone Pattern (FR/BE/LUX), regex: "\\b(?:(?:\\+|00)?(?:32|33|352)|0)\\s?[1-9](?:[\\s.-]?\\d{2}){3,4}\\b", score: 0.8}] context: ["téléphone", "tel", "mobile", "gsm", "contact"] + - name: JobTitleRecognizer + supported_language: fr + supported_entity: JOB_TITLE + patterns: + - name: Common Job Titles + regex: "(?i)\\b(Gérant|Directeur des Investissements|Directeur|Directrice|Président|CEO|CFO|CTO|Manager|Responsable|Chef de projet)\\b" + score: 0.8 + context: ["représentée par", "fonction", "poste", "attention de"] + - name: PostalCodeRecognizer + supported_language: fr + supported_entity: POSTAL_CODE + patterns: + - name: Postal Code FR/BE + regex: "\\b[0-9]{4,5}\\b" + score: 0.9 + context: ["adresse", "code postal"] + # --- DÉTECTEURS FINANCIERS ET LÉGAUX --- - name: CreditCardRecognizer supported_language: fr supported_entity: CREDIT_CARD_NUMBER @@ -68,13 +83,29 @@ recognizer_registry: regex: "\\b(?:4[0-9]{3}(?:[ -]?[0-9]{4}){3}|5[1-5][0-9]{2}(?:[ -]?[0-9]{4}){3})\\b" score: 0.95 context: ["carte bancaire", "visa", "mastercard"] - - name: IbanRecognizer supported_language: fr supported_entity: IBAN patterns: [{name: IBAN Pattern, regex: "\\b[A-Z]{2}[0-9]{2}\\s?(?:[A-Z0-9]{4}\\s?){2,7}[A-Z0-9]{1,4}\\b", score: 0.95}] context: ["iban", "compte", "bancaire"] + - name: MoneyRecognizer + supported_language: fr + supported_entity: MONEY + patterns: + - name: Money Pattern EUR + regex: "(?:EUR|€)\\s*\\d{1,3}(?:[.,\\s]\\d{3})*(?:[.,]\\d{2})?|\\d{1,3}(?:[.,\\s]\\d{3})*(?:[.,]\\d{2})?\\s*(?:EUR|€)" + score: 0.9 + context: ["montant", "prix", "eur", "euros"] + - name: CompanyFormRecognizer + supported_language: fr + supported_entity: LEGAL_FORM + patterns: + - name: Common Legal Forms + regex: "\\b(SPRL|SARL|SA|SCS|SNC|SCRI|SCA|SRL|SC)\\b" + score: 0.9 + context: ["société", "entreprise"] + # --- NUMÉROS D'IDENTIFICATION (FRANCE) --- - name: FrenchINSEERecognizer supported_language: fr supported_entity: FR_SOCIAL_SECURITY_NUMBER @@ -83,23 +114,59 @@ recognizer_registry: regex: "\\b[12]\\s*[0-9]{2}\\s*(?:0[1-9]|1[0-2])\\s*(?:2[ABab]|[0-9]{2})\\s*[0-9]{3}\\s*[0-9]{3}\\s*[0-9]{2}\\b" score: 0.95 context: ["sécurité sociale", "insee", "nir"] - + - name: FrenchSIRENSIRETRecognizer + supported_language: fr + supported_entity: FR_SIREN_SIRET + patterns: + - {name: SIRET Pattern, regex: "\\b[0-9]{3}[\\s]?[0-9]{3}[\\s]?[0-9]{3}[\\s]?[0-9]{5}\\b", score: 0.9} + - {name: SIREN Pattern, regex: "\\b[0-9]{3}[\\s]?[0-9]{3}[\\s]?[0-9]{3}\\b", score: 0.85} + context: ["siren", "siret"] + - name: FrenchPassportRecognizer + supported_language: fr + supported_entity: FR_PASSPORT + patterns: [{name: French Passport, regex: "\\b[0-9]{2}[A-Z]{2}[0-9]{5}\\b", score: 1.0}] + context: ["passeport"] + - name: FrenchIDCardRecognizer + supported_language: fr + supported_entity: FR_ID_CARD_NUMBER + patterns: [{name: French CNI, regex: "\\b[0-9]{12}\\b", score: 0.8}] + context: ["cni", "carte nationale d'identité"] + - name: FrenchLicensePlateRecognizer + supported_language: fr + supported_entity: FR_LICENSE_PLATE + patterns: [{name: French License Plate, regex: "\\b([A-Z]{2}-\\d{3}-[A-Z]{2}|\\d{1,4}\\s[A-Z]{2,3}\\s\\d{2,3})\\b", score: 0.8}] + context: ["plaque", "immatriculation"] + + # --- NUMÉROS D'IDENTIFICATION (BELGIQUE) --- - name: BelgianNRNRecognizer supported_language: fr supported_entity: BE_NATIONAL_REGISTER_NUMBER patterns: [{name: NRN Pattern, regex: "\\b[0-9]{2}\\.[0-9]{2}\\.[0-9]{2}-[0-9]{3}\\.[0-9]{2}\\b", score: 1.0}] context: ["registre national", "nrn", "niss"] - - name: BelgianEnterpriseRecognizer supported_language: fr supported_entity: BE_ENTERPRISE_NUMBER patterns: [{name: BE Enterprise Number, regex: "\\bBE\\s?0\\d{3}[\\.\\s]?\\d{3}[\\.\\s]?\\d{3}\\b", score: 0.95}] context: ["numéro d'entreprise", "btw", "tva", "BCE", "KBO"] + - name: BelgianIDCardRecognizer + supported_language: fr + supported_entity: BE_ID_CARD_NUMBER + patterns: [{name: "Belgian ID Card Number", regex: "\\b\\d{3}-\\d{7}-\\d{2}\\b", score: 1.0}] + context: ["carte d'identité", "eid"] + - name: BelgianLicensePlateRecognizer + supported_language: fr + supported_entity: BE_LICENSE_PLATE + patterns: [{name: "Belgian License Plate", regex: "\\b(?:[1-9]-\\w{3}-\\d{3}|\\w{3}-\\d{3})\\b", score: 0.8}] + context: ["plaque", "immatriculation"] + - name: BelgianPassportRecognizer + supported_language: fr + supported_entity: BE_PASSPORT + patterns: [{name: Belgian Passport, regex: "\\b[A-Z]{2}\\d{6}\\b", score: 1.0}] + context: ["passeport"] # 3. LISTE D'EXCLUSION (ALLOW LIST) # ===================================================================== allow_list: - # On garde une liste minimale car les détecteurs sont maintenant plus précis - Contrat - Document - Société @@ -154,9 +221,20 @@ anonymizer_config: EMAIL_ADDRESS: replace PHONE_NUMBER: replace IBAN: replace + MONEY: replace + JOB_TITLE: replace + POSTAL_CODE: replace + LEGAL_FORM: replace BE_NATIONAL_REGISTER_NUMBER: replace BE_ENTERPRISE_NUMBER: replace + BE_ID_CARD_NUMBER: replace + BE_LICENSE_PLATE: replace + BE_PASSPORT: replace FR_SOCIAL_SECURITY_NUMBER: replace + FR_SIREN_SIRET: replace + FR_PASSPORT: replace + FR_ID_CARD_NUMBER: replace + FR_LICENSE_PLATE: replace replacements: PERSON: "" @@ -168,6 +246,17 @@ anonymizer_config: EMAIL_ADDRESS: "" PHONE_NUMBER: "" IBAN: "" + MONEY: "" + JOB_TITLE: "" + POSTAL_CODE: "" + LEGAL_FORM: "" BE_NATIONAL_REGISTER_NUMBER: "" BE_ENTERPRISE_NUMBER: "" + BE_ID_CARD_NUMBER: "" + BE_LICENSE_PLATE: "" + BE_PASSPORT: "" FR_SOCIAL_SECURITY_NUMBER: "" + FR_SIREN_SIRET: "" + FR_PASSPORT: "" + FR_ID_CARD_NUMBER: "" + FR_LICENSE_PLATE: ""