From 7198e1ae5033d5eb42ed979486485385dc8c6502 Mon Sep 17 00:00:00 2001 From: aoezyetimoglu Date: Tue, 7 Dec 2021 13:04:10 +0100 Subject: [PATCH] RED-2841: INC6207970 Rule for initials expansion should be applied only to dictionary entries without whitespaces --- .../v1/server/redaction/model/Section.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java index e364ec34..ac1b0dde 100644 --- a/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java +++ b/redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java @@ -142,18 +142,18 @@ public class Section { @ThenAction public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, - @Argument(ArgumentType.REGEX) String pattern, + @Argument(ArgumentType.REGEX) String suffixPattern, @Argument(ArgumentType.BOOLEAN) boolean patternCaseInsensitive, @Argument(ArgumentType.INTEGER) int group, - @Argument(ArgumentType.REGEX) String withoutPattern) { + @Argument(ArgumentType.REGEX) String compiledValuePattern) { - Pattern compiledWithoutPattern = null; + Pattern compiledValuePat = null; - if (withoutPattern != null) { - compiledWithoutPattern = Patterns.getCompiledPattern(withoutPattern, patternCaseInsensitive); + if (compiledValuePattern != null) { + compiledValuePat = Patterns.getCompiledPattern(compiledValuePattern, patternCaseInsensitive); } - Pattern compiledPattern = Patterns.getCompiledPattern(pattern, patternCaseInsensitive); + Pattern compiledPattern = Patterns.getCompiledPattern(suffixPattern, patternCaseInsensitive); Set expanded = new HashSet<>(); for (Entity entity : entities) { @@ -162,9 +162,9 @@ public class Section { continue; } - if(withoutPattern != null) { - Matcher matcherWithout = compiledWithoutPattern.matcher(entity.getWord()); - if (matcherWithout.find()) { + if(compiledValuePattern != null) { + Matcher matcherCompiledValuePattern = compiledValuePat.matcher(entity.getWord()); + if (!matcherCompiledValuePattern.find()) { continue; } }