diff --git a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/DocumentTree.java b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/DocumentTree.java index 23c31bb8..8597b14d 100644 --- a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/DocumentTree.java +++ b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/DocumentTree.java @@ -4,12 +4,14 @@ import static java.lang.String.format; import java.util.ArrayList; import java.util.Collections; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Optional; import java.util.stream.Stream; import com.iqser.red.service.redaction.v1.server.model.document.entity.Containment; +import com.iqser.red.service.redaction.v1.server.model.document.entity.EntityType; import com.iqser.red.service.redaction.v1.server.model.document.entity.Equality; import com.iqser.red.service.redaction.v1.server.model.document.entity.Intersection; import com.iqser.red.service.redaction.v1.server.model.document.entity.TextEntity; @@ -373,21 +375,27 @@ public class DocumentTree { EntityCreationUtility.addToPages(entity); EntityCreationUtility.addEntityToNodeEntitySets(entity); + + if (entity.getEntityType().equals(EntityType.TEMPORARY)) { + return; + } + for (TextEntity textEntity : entity.getDeepestFullyContainingNode().getEntities()) { - if (entity.intersects(textEntity) && !entity.equals(textEntity)) { + if (entity.intersects(textEntity) && !entity.equals(textEntity) && !textEntity.getEntityType().equals(EntityType.TEMPORARY)) { if (textEntity.getTextRange().equals(entity.getTextRange())) { - textEntity.getRelations().put(textEntity, new Equality(entity, textEntity)); - entity.getRelations().put(textEntity, new Equality(textEntity, entity)); + textEntity.getRelations().computeIfAbsent(textEntity, k -> new HashSet<>()).add(new Equality(entity, textEntity)); + entity.getRelations().computeIfAbsent(textEntity, k -> new HashSet<>()).add(new Equality(textEntity, entity)); } else if (textEntity.containedBy(entity)) { - entity.getRelations().put(textEntity, new Containment(entity, textEntity)); - textEntity.getRelations().put(entity, new Intersection(textEntity, entity)); + entity.getRelations().computeIfAbsent(textEntity, k -> new HashSet<>()).add(new Containment(entity, textEntity)); + textEntity.getRelations().computeIfAbsent(entity, k -> new HashSet<>()).add(new Intersection(textEntity, entity)); } else if (entity.containedBy(textEntity)) { - textEntity.getRelations().put(entity, new Containment(textEntity, entity)); - entity.getRelations().put(textEntity, new Intersection(entity, textEntity)); + textEntity.getRelations().computeIfAbsent(entity, k -> new HashSet<>()).add(new Containment(textEntity, entity)); + entity.getRelations().computeIfAbsent(textEntity, k -> new HashSet<>()).add(new Intersection(entity, textEntity)); } else { - entity.getRelations().put(textEntity, new Intersection(entity, textEntity)); - textEntity.getRelations().put(entity, new Intersection(textEntity, entity)); + entity.getRelations().computeIfAbsent(textEntity, k -> new HashSet<>()).add(new Intersection(entity, textEntity)); + textEntity.getRelations().computeIfAbsent(entity, k -> new HashSet<>()).add(new Intersection(textEntity, entity)); } + } } } diff --git a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/AbstractRelation.java b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/AbstractRelation.java index cee877ca..97b3d90e 100644 --- a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/AbstractRelation.java +++ b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/AbstractRelation.java @@ -10,4 +10,11 @@ public abstract class AbstractRelation implements Relation { protected final TextEntity a; protected final TextEntity b; + + @Override + public String toString() { + + return this.getClass().getSimpleName() + "{" + "a=" + a + ", b=" + b + '}'; + } + } diff --git a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/EntityType.java b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/EntityType.java index 1550265e..3af87e67 100644 --- a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/EntityType.java +++ b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/EntityType.java @@ -6,5 +6,6 @@ public enum EntityType { RECOMMENDATION, FALSE_POSITIVE, FALSE_RECOMMENDATION, - DICTIONARY_REMOVAL + DICTIONARY_REMOVAL, + TEMPORARY } diff --git a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/TextEntity.java b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/TextEntity.java index 097e4956..365d110b 100644 --- a/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/TextEntity.java +++ b/redaction-service-v1/document/src/main/java/com/iqser/red/service/redaction/v1/server/model/document/entity/TextEntity.java @@ -74,7 +74,7 @@ public class TextEntity implements IEntity { SemanticNode deepestFullyContainingNode; @Builder.Default - Map relations = new HashMap<>(); + Map> relations = new HashMap<>(); @Builder.Default Collection entityEventListeners = new ArrayList<>(); @@ -174,7 +174,7 @@ public class TextEntity implements IEntity { pages.forEach(page -> page.getEntities().remove(this)); intersectingNodes = new LinkedList<>(); relations.keySet() - .forEach(entity -> entity.relations.remove(this)); + .forEach(entity -> entity.getRelations().remove(this)); relations = new HashedMap<>(); deepestFullyContainingNode = null; pages = new HashSet<>(); diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityFindingUtility.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityFindingUtility.java index 7755015d..31174f1b 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityFindingUtility.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityFindingUtility.java @@ -181,7 +181,7 @@ public class EntityFindingUtility { return textBlocks.stream() .flatMap(searchImplementation::getBoundaries) - .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.ENTITY, node, Collections.emptySet())) + .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.TEMPORARY, node, Collections.emptySet())) .filter(Optional::isPresent) .map(Optional::get) .distinct() @@ -208,7 +208,7 @@ public class EntityFindingUtility { return textBlocks.stream() .flatMap(tb -> searchImplementation.getBoundaries(tb) .filter(textRange -> entityCreationService.isValidEntityTextRange(tb, textRange))) - .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.ENTITY, document, Collections.emptySet())) + .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.TEMPORARY, document, Collections.emptySet())) .filter(Optional::isPresent) .map(Optional::get) .distinct() @@ -222,7 +222,7 @@ public class EntityFindingUtility { return searchImplementation.getBoundaries(document.getTextBlock()) .filter(textRange -> entityCreationService.isValidEntityTextRange(document.getTextBlock(), textRange)) - .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.ENTITY, document, Collections.emptySet())) + .map(boundary -> entityCreationService.byTextRangeWithEngine(boundary, "temp", EntityType.TEMPORARY, document, Collections.emptySet())) .filter(Optional::isPresent) .map(Optional::get) .distinct() diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityLogCreatorService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityLogCreatorService.java index 7e131918..c92d0d42 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityLogCreatorService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/EntityLogCreatorService.java @@ -431,7 +431,7 @@ public class EntityLogCreatorService { private static EntryType getEntryType(EntityType entityType) { return switch (entityType) { - case ENTITY -> EntryType.ENTITY; + case ENTITY, TEMPORARY -> EntryType.ENTITY; case HINT -> EntryType.HINT; case FALSE_POSITIVE, DICTIONARY_REMOVAL -> EntryType.FALSE_POSITIVE; case RECOMMENDATION -> EntryType.RECOMMENDATION; diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/ManualChangesApplicationService.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/ManualChangesApplicationService.java index dd1bde9d..1c8fcd5d 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/ManualChangesApplicationService.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/ManualChangesApplicationService.java @@ -90,7 +90,7 @@ public class ManualChangesApplicationService { .map(ManualChangesApplicationService::toRectangle2D) .collect(Collectors.toList())); - entityToBeResized.addManualChange(manualResizeRedaction); + entityToBeResized.getManualOverwrite().addChange(manualResizeRedaction); SemanticNode node = entityToBeResized.getDeepestFullyContainingNode(); PrecursorEntity searchEntity = PrecursorEntity.fromManualResizeRedaction(manualResizeRedaction); @@ -106,7 +106,7 @@ public class ManualChangesApplicationService { .stream() .flatMap(Collection::stream) .forEach(TextEntity::removeFromGraph); - return; + break; } possibleEntities.values() @@ -117,9 +117,10 @@ public class ManualChangesApplicationService { if (node.hasParent()) { node = node.getParent(); } else { - break; + node = null; } } + entityToBeResized.notifyEntityUpdated(); } diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/KieSessionUpdater.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/KieSessionUpdater.java index 01c85328..ac43e210 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/KieSessionUpdater.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/service/drools/KieSessionUpdater.java @@ -1,5 +1,9 @@ package com.iqser.red.service.redaction.v1.server.service.drools; +import java.util.Collection; +import java.util.Collections; +import java.util.function.Consumer; + import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; @@ -26,17 +30,11 @@ public class KieSessionUpdater implements EntityEventListener { onEntityInserted(entity); } + @Override public void onEntityInserted(IEntity entity) { - if (entity instanceof TextEntity textEntity) { - updateIntersectingNodes(textEntity); - textEntity.getRelations().values() - .forEach(kieSession::insert); - textEntity.getRelations().keySet() - .forEach(k -> kieSession.insert(k.getRelations() - .get(textEntity))); - } + handleOnEntityEvent(entity, kieSession::insert); kieSession.insert(entity); } @@ -44,21 +42,7 @@ public class KieSessionUpdater implements EntityEventListener { @Override public void onEntityUpdated(IEntity entity) { - if (entity instanceof TextEntity textEntity) { - updateIntersectingNodes(textEntity); - textEntity.getRelations().values() - .forEach(this::updateFactIfPresent); - textEntity.getRelations().keySet() - .forEach(k -> updateFactIfPresent(k.getRelations() - .get(textEntity))); - } - if (entity instanceof Image image) { - SemanticNode parent = image; - while (parent.hasParent()) { - parent = parent.getParent(); - kieSession.update(kieSession.getFactHandle(parent), parent); - } - } + handleOnEntityEvent(entity, this::updateFactIfPresent); kieSession.update(kieSession.getFactHandle(entity), entity); } @@ -66,14 +50,24 @@ public class KieSessionUpdater implements EntityEventListener { @Override public void onEntityRemoved(IEntity entity) { + handleOnEntityEvent(entity, this::deleteFactIfPresent); + kieSession.delete(kieSession.getFactHandle(entity)); + } + + + private void handleOnEntityEvent(IEntity entity, Consumer consumer) { + if (entity instanceof TextEntity textEntity) { updateIntersectingNodes(textEntity); textEntity.getRelations().values() - .forEach(this::deleteFactIfPresent); + .stream() + .flatMap(Collection::stream) + .forEach(consumer); textEntity.getRelations().keySet() - .forEach(k -> deleteFactIfPresent(k.getRelations() - .get(textEntity))); + .forEach(k -> k.getRelations().getOrDefault(textEntity, Collections.emptySet()) + .forEach(consumer)); } + if (entity instanceof Image image) { SemanticNode parent = image; while (parent.hasParent()) { @@ -81,7 +75,6 @@ public class KieSessionUpdater implements EntityEventListener { kieSession.update(kieSession.getFactHandle(parent), parent); } } - kieSession.delete(kieSession.getFactHandle(entity)); } 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 30c9f4d6..e9cf3990 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 @@ -1437,7 +1437,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -1462,7 +1462,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1482,7 +1482,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1498,7 +1498,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1567,7 +1567,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java index 4d4ee6d2..b7a43b2f 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/RedactionIntegrationTest.java @@ -1666,7 +1666,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest { .build())) .resizeRedactions(Set.of(ManualResizeRedaction.builder() .updateDictionary(false) - .annotationId(davidKsenia.getId()) + .annotationId("newId") .fileId(TEST_FILE_ID) .user("user") .requestDate(OffsetDateTime.now()) @@ -1691,7 +1691,7 @@ public class RedactionIntegrationTest extends RulesIntegrationTest { assertEquals(EntryState.APPLIED, resizedEntity.getState()); assertEquals("David", resizedEntity.getValue()); - assertEquals(1, resizedEntity.getManualChanges().size()); + assertEquals(2, resizedEntity.getManualChanges().size()); assertEquals(1, resizedEntity.getEngines().size()); assertEquals(EntryState.REMOVED, removedEntity.getState()); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/PrecursorEntityTest.java b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/PrecursorEntityTest.java index 8f7deae9..9a79a0ee 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/PrecursorEntityTest.java +++ b/redaction-service-v1/redaction-service-server-v1/src/test/java/com/iqser/red/service/redaction/v1/server/manualchanges/PrecursorEntityTest.java @@ -158,7 +158,7 @@ public class PrecursorEntityTest extends BuildDocumentIntegrationTest { Document document = buildGraph("files/syngenta/CustomerFiles/VV-919901.pdf"); EntityCreationService entityCreationService = new EntityCreationService(); - List tempEntities = entityCreationService.byString("To: Syngenta Ltd.", "temp", EntityType.ENTITY, document) + List tempEntities = entityCreationService.byString("To: Syngenta Ltd.", "temp", EntityType.TEMPORARY, document) .toList(); assertFalse(tempEntities.isEmpty()); var tempEntity = tempEntities.get(0); diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/CBI_author.txt b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/CBI_author.txt index fed8ecb3..0c1622fc 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/CBI_author.txt +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/CBI_author.txt @@ -8625,4 +8625,5 @@ Mustermann Lastname Bojangles Tambourine Man -Tournayre J.C. \ No newline at end of file +Tournayre J.C. +Phillip \ No newline at end of file diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/PII.txt b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/PII.txt index cbcbfe3d..86c5d8ca 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/PII.txt +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/PII.txt @@ -11,7 +11,6 @@ Sude Halide Nurullah Xinyi Y. Tao Dorn Prasher -David annotation J.B. RASCLE (果梗を除去したもの) 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 e1bb28c0..76c80801 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 @@ -1237,7 +1237,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -1262,7 +1262,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1282,7 +1282,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1298,7 +1298,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1367,7 +1367,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -1401,7 +1401,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 4d15c4ee..625ca7d0 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 @@ -2001,7 +2001,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -2026,7 +2026,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -2046,7 +2046,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -2062,7 +2062,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -2131,7 +2131,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -2165,7 +2165,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 53872178..6f7b1efc 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 @@ -1373,7 +1373,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -1398,7 +1398,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1418,7 +1418,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1434,7 +1434,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1503,7 +1503,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( 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 23cdb87b..d2bbd9db 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 @@ -964,7 +964,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -989,7 +989,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1009,7 +1009,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1025,7 +1025,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1094,7 +1094,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -1128,7 +1128,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 d7ee44ca..3988bd1a 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 @@ -285,7 +285,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -310,7 +310,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -330,7 +330,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -346,7 +346,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -415,7 +415,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -449,7 +449,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 a4fc7947..6580da5f 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 @@ -1258,8 +1258,9 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ + // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -1284,7 +1285,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1302,8 +1303,9 @@ rule "X.0.1: Remove Container and Contained Entities with Manual Changes" $contained.remove("X.0.1", "remove Entity contained by Entity of same type with manual changes"); end + // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1319,7 +1321,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1335,6 +1337,7 @@ rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" $contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE"); end + // Rule unit: X.3 rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION" salience 64 @@ -1352,6 +1355,7 @@ rule "X.3.0: Remove RECOMMENDATION Contained by FALSE_RECOMMENDATION" $contained.remove("X.3.0", "remove Entity of type RECOMMENDATION when contained by FALSE_RECOMMENDATION"); end + // Rule unit: X.4 rule "X.4.0: Remove Entity of type RECOMMENDATION when text range equals ENTITY with same type" salience 256 @@ -1370,6 +1374,7 @@ rule "X.4.0: Remove Entity of type RECOMMENDATION when text range equals ENTITY $b.remove("X.4.0", "remove Entity of type RECOMMENDATION when text range equals ENTITY with same type"); end + // Rule unit: X.5 rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" salience 256 @@ -1386,7 +1391,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -1402,6 +1407,7 @@ rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority R $contained.remove("X.5.1", "remove Entity of type RECOMMENDATION when contained by RECOMMENDATION"); end + // Rule unit: X.6 rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" salience 32 @@ -1419,7 +1425,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( @@ -1435,6 +1441,7 @@ rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" $contained.remove("X.6.1", "remove Entity when contained in another entity of type ENTITY or HINT with larger text range"); end + // Rule unit: X.8 rule "X.8.0: Remove Entity when text range and type equals to imported Entity" salience 257 @@ -1468,6 +1475,7 @@ rule "X.8.1: Remove Entity when intersected by imported Entity" $b.remove("X.8.1", "remove Entity when intersected by imported Entity"); end + // Rule unit: X.9 rule "X.9.0: Merge mostly contained signatures" when @@ -1488,6 +1496,7 @@ rule "X.10.0: remove false positives of ai" $aiSignature.remove("X.10.0", "Removed because false positive"); end + // Rule unit: X.11 rule "X.11.1: Remove non-manual entity which intersects with a manual entity" salience 64 @@ -1522,7 +1531,6 @@ rule "X.11.2: Remove non-manual entity which is equal to manual entity" 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 97cdf6f5..d392e0bd 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 @@ -345,7 +345,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -370,7 +370,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -390,7 +390,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -406,7 +406,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -475,7 +475,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -509,7 +509,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 27f04f33..2c3027ee 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 @@ -435,7 +435,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -460,7 +460,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -480,7 +480,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -496,7 +496,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -565,7 +565,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -599,7 +599,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 03241e56..7aa4c76d 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 @@ -335,7 +335,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -360,7 +360,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -380,7 +380,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -396,7 +396,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -412,7 +412,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -428,7 +428,7 @@ rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" $contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -497,7 +497,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -531,7 +531,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/performance/dictionaries/EFSA_sanitisation_GFL_v1/rules.drl b/redaction-service-v1/redaction-service-server-v1/src/test/resources/performance/dictionaries/EFSA_sanitisation_GFL_v1/rules.drl index 0469fad3..fcb55325 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/performance/dictionaries/EFSA_sanitisation_GFL_v1/rules.drl +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/performance/dictionaries/EFSA_sanitisation_GFL_v1/rules.drl @@ -848,7 +848,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -873,7 +873,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -893,7 +893,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -909,7 +909,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" $contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE"); end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -978,7 +978,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -1012,7 +1012,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 f0360d91..9a49cd37 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 @@ -2020,7 +2020,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -2046,7 +2046,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -2084,7 +2084,7 @@ rule "X.0.4: Remove Entity contained by Entity of same type" end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -2101,7 +2101,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -2170,7 +2170,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" $b.remove("X.5.0", "remove Entity of type RECOMMENDATION when intersected by ENTITY"); end -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment( @@ -2204,7 +2204,7 @@ rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT" $contained.remove("X.6.0", "remove Entity of lower rank when contained by entity of type ENTITY or HINT"); end -rule "X.6.1: Remove Smaller Text Range Contained by ENTITY or HINT" +rule "X.6.1: Remove Entity, when contained in another entity of type ENTITY or HINT with larger text range" salience 32 when $containment: Containment( 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 d9177618..1a2d6cb5 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 @@ -1439,7 +1439,7 @@ rule "MAN.4.1: Apply legal basis change" //------------------------------------ Entity merging rules ------------------------------------ // Rule unit: X.0 -rule "X.0.0: Remove Container Entity Contained by Container of Same Type" +rule "X.0.0: Remove Entity contained by Entity of same type" salience 65 when $containment: Containment( @@ -1464,7 +1464,7 @@ rule "X.0.0: Remove Container Entity Contained by Container of Same Type" $contained.remove("X.0.0", "remove Entity contained by Entity of same type"); end -rule "X.0.1: Remove Container and Contained Entities with Manual Changes" +rule "X.0.1: Remove Entity contained by Entity of same type with manual changes" salience 65 when $containment: Containment( @@ -1484,7 +1484,7 @@ end // Rule unit: X.2 -rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" +rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1501,7 +1501,7 @@ rule "X.2.0: Remove ENTITY and FALSE_POSITIVE Containing It" end -rule "X.2.1: Remove HINT Contained by FALSE_POSITIVE" +rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE" salience 64 when $containment: Containment( @@ -1572,7 +1572,7 @@ rule "X.5.0: Remove Entity of type RECOMMENDATION when intersected by ENTITY" // Rule unit: X.5 -rule "X.5.1: Remove Lower Priority RECOMMENDATION Contained by Higher Priority RECOMMENDATION" +rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATION" salience 256 when $containment: Containment(