Pull request #19: Avoid duplicate redaction if type have same entries, made Applicant and Producer rules more specific

Merge in RED/redaction-service from ApplicantRule to master

* commit '99bac4550a9cade36de313735916687ea26d7b4d':
  Use @EqualsAndHashCode(onlyExplicitlyIncluded = true) in Entity.java
  Avoid duplicate redaction if type have same entries, made Applicant and Producer rules more specific
This commit is contained in:
Dominique Eiflaender 2020-08-07 12:31:26 +02:00
commit 40e40a01ad
3 changed files with 17 additions and 18 deletions

View File

@ -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<EntityPositionSequence> 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<EntityPositionSequence> 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;
}
}

View File

@ -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
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

View File

@ -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
end