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

This commit is contained in:
maverickstuder 2025-01-08 11:34:38 +01:00
parent c8dd167606
commit 21097a6419
13 changed files with 229 additions and 32 deletions

View File

@ -1584,6 +1584,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512

View File

@ -1315,6 +1315,7 @@ rule "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
when
@ -1384,6 +1385,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -2079,6 +2079,7 @@ rule "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
when
@ -2148,6 +2149,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -1451,6 +1451,7 @@ rule "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
when
@ -1520,6 +1521,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512

View File

@ -1042,6 +1042,7 @@ rule "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
when
@ -1111,6 +1112,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -363,6 +363,7 @@ rule "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
when
@ -432,6 +433,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -1408,6 +1408,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -423,6 +423,7 @@ rule "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
when
@ -492,6 +493,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -513,6 +513,7 @@ rule "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
when
@ -582,6 +583,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -396,38 +396,6 @@ rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
end
rule "X.2.0: Remove Entity of type ENTITY when contained by FALSE_POSITIVE"
salience 64
when
$containment: Containment(
$container: container,
$contained: contained,
$container.entityType == EntityType.FALSE_POSITIVE,
$container.active(),
$contained.entityType == EntityType.ENTITY,
$contained.type() == $container.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.2.0", "remove Entity of type ENTITY when contained by FALSE_POSITIVE");
end
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
salience 64
when
$containment: Containment(
$container: container,
$contained: contained,
$container.entityType == EntityType.FALSE_POSITIVE,
$container.active(),
$contained.entityType == EntityType.HINT,
$contained.type() == $container.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.2.1", "remove Entity of type HINT when contained by FALSE_POSITIVE");
end
rule "X.2.1: Remove Entity of type HINT when contained by FALSE_POSITIVE"
salience 64
when
@ -445,6 +413,7 @@ rule "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
when
@ -514,6 +483,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -995,6 +995,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -2187,6 +2187,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.6
rule "X.6.0: Remove Lower Rank Entity Contained by ENTITY or HINT"
salience 32

View File

@ -1589,6 +1589,23 @@ 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
$intersection: Containment(
$container: container,
$contained: contained,
($container.entityType == EntityType.ENTITY || $container.entityType == EntityType.HINT),
!$container.removed(),
$contained.entityType == EntityType.RECOMMENDATION,
$container.type() == $contained.type(),
!$contained.hasManualChanges()
)
then
$contained.remove("X.5.2", "remove Entity of type RECOMMENDATION when contained by ENTITY of same type");
end
// Rule unit: X.7
rule "X.7.0: Remove all images"
salience 512