diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Entity.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Entity.java index de6d56eb..776ae1b0 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Entity.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Entity.java @@ -1,6 +1,5 @@ package com.iqser.red.service.redaction.v1.server.redaction.model; - import java.util.ArrayList; import java.util.List; @@ -8,35 +7,28 @@ import lombok.Data; import lombok.EqualsAndHashCode; @Data -@EqualsAndHashCode +@EqualsAndHashCode(onlyExplicitlyIncluded = true) public class Entity { + @EqualsAndHashCode.Include private final String word; private final String type; - - @EqualsAndHashCode.Exclude private boolean redaction; - - @EqualsAndHashCode.Exclude private String redactionReason; - - @EqualsAndHashCode.Exclude private List positionSequences = new ArrayList<>(); - - @EqualsAndHashCode.Exclude private Integer start; - - @EqualsAndHashCode.Exclude private Integer end; + @EqualsAndHashCode.Include private String headline; - - @EqualsAndHashCode.Exclude private int matchedRule; + @EqualsAndHashCode.Include private int sectionNumber; + public Entity(String word, String type, boolean redaction, String redactionReason, List positionSequences, String headline, int matchedRule, int sectionNumber) { + this.word = word; this.type = type; this.redaction = redaction; @@ -47,7 +39,9 @@ public class Entity { this.sectionNumber = sectionNumber; } + public Entity(String word, String type, Integer start, Integer end, String headline, int sectionNumber) { + this.word = word; this.type = type; this.start = start; @@ -55,4 +49,5 @@ public class Entity { this.headline = headline; this.sectionNumber = sectionNumber; } + } diff --git a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/addresses.txt b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/addresses.txt index 5d3b1710..e8630bcd 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/addresses.txt +++ b/redaction-service-v1/redaction-service-server-v1/src/test/resources/dictionaries/addresses.txt @@ -802,4 +802,7 @@ Syngenta Crop Protection AG European Product Registration B8.4.29 Scharzwaldalll Adama Agriculture BV Arnhemseweg 87 NL-3832 GK Leusden The Netherlands Eurofins Regulatory AG Weidenweg 15 CH-4310 Rheinfelden Switzerland Cheminova A/S Thyborønvej 78, DK-7673 Harboøre, Denmark P.O. Box 9 DK-7620 Lemvig Denmark -Helm AG Nordkanalstrasse 28 20097 Hamburg Germany \ No newline at end of file +Helm AG Nordkanalstrasse 28 20097 Hamburg Germany +ADAMA Agriculture B.V. Arnhemseweg 87 NL-3832 GK Leusden The Netherlands +Adama Agriculture BV +Cheminova A/S Thyborønvej 78, DK-7673 Harboøre, Denmark 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 7a10f7c6..20f24015 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 @@ -60,7 +60,7 @@ rule "6: Redact if must redact entry is found" rule "7: Redact contact information, if applicant is found" when - eval(section.getText().toLowerCase().contains("applicant") == true); + eval(section.headlineContainsWord("applicant") || section.getText().contains("Applicant")); then section.redactLineAfter("Name:", "address", 7, "Applicant information was found"); section.redactBetween("Address:", "Contact", "address", 7, "Applicant information was found"); @@ -81,7 +81,7 @@ rule "7: Redact contact information, if applicant is found" rule "8: Redact contact information, if Producer is found" when - eval(section.getText().contains("Producer") || section.getText().contains("Manufacturer of the active substance") || section.getText().contains("Manufacturer:")); + eval(section.getText().toLowerCase().contains("producer of the plant protection") || section.getText().toLowerCase().contains("producer of the active substance") || section.getText().contains("Manufacturer of the active substance") || section.getText().contains("Manufacturer:") || section.getText().contains("Producer or producers of the active substance")); then section.redactLineAfter("Name:", "address", 8, "Producer was found"); section.redactBetween("Address:", "Contact", "address", 8, "Producer was found"); @@ -97,4 +97,5 @@ rule "8: Redact contact information, if Producer is found" section.redactLineAfter("Telephone number:", "address", 8, "Producer was found"); section.redactLineAfter("Tel:", "address", 8, "Producer was found"); section.redactBetween("No:", "Fax", "address", 8, "Producer was found"); - end \ No newline at end of file + end +