Merge branch 'RED-10687-bp' into 'release/4.423.x'

RED-10687: Filter out overlapping recommendations if they are of the same type

See merge request redactmanager/redaction-service!581
This commit was merged in pull request #581.
This commit is contained in:
Maverick Studer
2025-01-08 13:19:45 +01:00
14 changed files with 144 additions and 1 deletions
@@ -1548,6 +1548,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512
@@ -1350,6 +1350,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -2117,6 +2117,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -1485,6 +1485,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512
@@ -1077,6 +1077,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -397,6 +397,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -1372,6 +1372,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -455,6 +455,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -547,6 +547,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -468,6 +468,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -960,6 +960,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -2147,6 +2147,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.6
rule "X.6.0: Remove Entity of lower rank, when contained by entity of type ENTITY or HINT"
salience 32
@@ -1554,6 +1554,17 @@ rule "X.5.1: Remove Entity of type RECOMMENDATION when contained by RECOMMENDATI
end
rule "X.5.2: Remove Entity of type RECOMMENDATION when contained by ENTITY of same type"
salience 256
when
$entity: TextEntity($type: type(), (entityType == EntityType.ENTITY || entityType == EntityType.HINT), !removed())
$recommendation: TextEntity(containedBy($entity), type() == $type, entityType == EntityType.RECOMMENDATION, !hasManualChanges())
then
$recommendation.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
retract($recommendation);
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512