RED-2862: Added possibility to ignore dictionaries by rule
This commit is contained in:
parent
9818ca7224
commit
44c77685a4
@ -153,6 +153,7 @@ public class Section {
|
|||||||
while (matcher.find()) {
|
while (matcher.find()) {
|
||||||
String match = matcher.group(group);
|
String match = matcher.group(group);
|
||||||
if (StringUtils.isNotBlank(match)) {
|
if (StringUtils.isNotBlank(match)) {
|
||||||
|
|
||||||
expanded.addAll(findEntities(entity.getWord() + match, type, false, entity.isRedaction(), entity.getMatchedRule(), entity
|
expanded.addAll(findEntities(entity.getWord() + match, type, false, entity.isRedaction(), entity.getMatchedRule(), entity
|
||||||
.getRedactionReason(), entity.getLegalBasis()));
|
.getRedactionReason(), entity.getLegalBasis()));
|
||||||
|
|
||||||
@ -221,6 +222,11 @@ public class Section {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void ignore(String type){
|
||||||
|
entities.removeIf(entity -> entity.getType().equals(type));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void expandToHintAnnotationByRegEx(String type, String pattern, boolean patternCaseInsensitive, int group,
|
public void expandToHintAnnotationByRegEx(String type, String pattern, boolean patternCaseInsensitive, int group,
|
||||||
String asType) {
|
String asType) {
|
||||||
|
|
||||||
|
|||||||
@ -782,6 +782,32 @@ public class RedactionIntegrationTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testIgnoreDossierRedactionIfConfidential() throws IOException {
|
||||||
|
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
|
||||||
|
AnalyzeRequest request = prepareStorage("files/new/VV-919901.pdf");
|
||||||
|
AnalyzeResult result = reanalyzeService.analyze(request);
|
||||||
|
|
||||||
|
AnnotateResponse annotateResponse = redactionController.annotate(AnnotateRequest.builder()
|
||||||
|
.dossierId(TEST_DOSSIER_ID)
|
||||||
|
.fileId(TEST_FILE_ID)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
try (FileOutputStream fileOutputStream = new FileOutputStream(getTemporaryDirectory() + "/Annotated.pdf")) {
|
||||||
|
fileOutputStream.write(annotateResponse.getDocument());
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
|
||||||
|
System.out.println("duration: " + (end - start));
|
||||||
|
System.out.println("numberOfPages: " + result.getNumberOfPages());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testManualRedaction() throws IOException {
|
public void testManualRedaction() throws IOException {
|
||||||
|
|
||||||
|
|||||||
@ -1 +1,2 @@
|
|||||||
Difenoconazole
|
Difenoconazole
|
||||||
|
FENPROPIDIN
|
||||||
@ -344,4 +344,11 @@ rule "29: Redact Dossier Redactions"
|
|||||||
Section(matchesType("dossier_redactions"))
|
Section(matchesType("dossier_redactions"))
|
||||||
then
|
then
|
||||||
section.redact("dossier_redactions", 29, "Dossier Redaction found", "Article 39(1)(2) of Regulation (EC) No 178/2002");
|
section.redact("dossier_redactions", 29, "Dossier Redaction found", "Article 39(1)(2) of Regulation (EC) No 178/2002");
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rule "30: Ignore dossier_redactions if confidential"
|
||||||
|
when
|
||||||
|
Section(!fileAttributeByLabelEqualsIgnoreCase("Confidentiality","confidential") && matchesType("dossier_redactions"));
|
||||||
|
then
|
||||||
|
section.ignore("dossier_redactions");
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user