From 6de0346052e0c6dc9aac0f09cc91d50841313074 Mon Sep 17 00:00:00 2001 From: Andrei Isvoran Date: Tue, 2 Apr 2024 08:33:54 +0200 Subject: [PATCH] RED-8775 - Add X.11 remove rule --- .../src/main/resources/drools/all_rules_documine.drl | 11 +++++++++++ .../src/test/resources/drools/acceptance_rules.drl | 12 ++++++++++++ .../resources/drools/all_redact_manager_rules.drl | 12 ++++++++++++ .../src/test/resources/drools/documine_flora.drl | 12 ++++++++++++ .../src/test/resources/drools/efsa_sanitisation.drl | 12 ++++++++++++ .../test/resources/drools/manual_redaction_rules.drl | 12 ++++++++++++ .../src/test/resources/drools/rules.drl | 12 ++++++++++++ .../src/test/resources/drools/rules_v2.drl | 12 ++++++++++++ .../src/test/resources/drools/table_demo.drl | 12 ++++++++++++ .../src/test/resources/drools/test_rules.drl | 12 ++++++++++++ .../src/main/resources/all_redact_manager_rules.drl | 12 ++++++++++++ .../src/main/resources/all_rules_documine.drl | 12 ++++++++++++ 12 files changed, 143 insertions(+) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/resources/drools/all_rules_documine.drl b/redaction-service-v1/redaction-service-server-v1/src/main/resources/drools/all_rules_documine.drl index 214730fe..db9412d7 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/resources/drools/all_rules_documine.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/main/resources/drools/all_rules_documine.drl @@ -1582,6 +1582,17 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + //------------------------------------ File attributes rules ------------------------------------ diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl index e6ae89eb..47932980 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/acceptance_rules.drl @@ -1391,6 +1391,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl index 4dc3512f..d68eb557 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/all_redact_manager_rules.drl @@ -2013,6 +2013,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl index f6a02f4d..56f61d36 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/documine_flora.drl @@ -1437,6 +1437,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/efsa_sanitisation.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/efsa_sanitisation.drl index b159e09f..776b665b 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/efsa_sanitisation.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/efsa_sanitisation.drl @@ -950,6 +950,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/manual_redaction_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/manual_redaction_rules.drl index c53bd38a..b326c76e 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/manual_redaction_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/manual_redaction_rules.drl @@ -278,6 +278,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl index 7aff5176..9a5fbb48 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules.drl @@ -1479,6 +1479,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules_v2.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules_v2.drl index 25fb3092..6f138a65 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules_v2.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/rules_v2.drl @@ -402,6 +402,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/table_demo.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/table_demo.drl index 30ae324b..13d6383c 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/table_demo.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/table_demo.drl @@ -523,6 +523,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/test_rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/test_rules.drl index 11a37645..0fea626a 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/test_rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/drools/test_rules.drl @@ -439,6 +439,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl b/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl index 4f9e24cc..40103b4f 100644 --- a/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl +++ b/redaction-service-v1/rules-management/src/main/resources/all_redact_manager_rules.drl @@ -2006,6 +2006,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0 diff --git a/redaction-service-v1/rules-management/src/main/resources/all_rules_documine.drl b/redaction-service-v1/rules-management/src/main/resources/all_rules_documine.drl index 03650c43..95862ecc 100644 --- a/redaction-service-v1/rules-management/src/main/resources/all_rules_documine.drl +++ b/redaction-service-v1/rules-management/src/main/resources/all_rules_documine.drl @@ -1582,6 +1582,18 @@ rule "X.10.0: remove false positives of ai" end +// Rule unit: X.11 +rule "X.11.0: Remove dictionary entity which intersects with a manual entity" + salience 64 + when + $manualEntity: TextEntity(engines contains Engine.MANUAL, active()) + $dictionaryEntity: TextEntity(intersects($manualEntity), dictionaryEntry, engines not contains Engine.MANUAL) + then + $dictionaryEntity.remove("X.11.0", "remove dictionary entity which intersects with a manual entity"); + retract($dictionaryEntity); + end + + //------------------------------------ Dictionary merging rules ------------------------------------ // Rule unit: DICT.0