Compare commits

...
4 Commits
Author SHA1 Message Date
aoezyetimoglu 3329773315 RED-3061: Logic for value matcher for initials expansion rule is inverted 2021-12-10 10:10:07 +01:00
aoezyetimoglu 4f51ef16ed Merge branch 'master' of ssh://git.iqser.com:2222/red/redaction-service 2021-12-10 10:09:44 +01:00
aoezyetimoglu e9f1a2734f Merge branch 'master' of ssh://git.iqser.com:2222/red/redaction-service
 Conflicts:
	redaction-service-v1/redaction-service-server-v1/src/main/java/com/iqser/red/service/redaction/v1/server/redaction/model/Section.java
2021-12-07 13:54:39 +01:00
aoezyetimoglu 7198e1ae50 RED-2841: INC6207970 Rule for initials expansion should be applied only to dictionary entries without whitespaces 2021-12-07 13:04:10 +01:00
@@ -163,6 +163,7 @@ public class Section {
@WhenCondition
public boolean matchesImageType(@Argument(ArgumentType.TYPE) String type) {
return images.stream().anyMatch(image -> image.getType().equals(type));
}
@@ -184,18 +185,19 @@ public class Section {
@ThenAction
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type, @Argument(ArgumentType.REGEX) String pattern,
public void expandByRegEx(@Argument(ArgumentType.TYPE) String type,
@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<Entity> expanded = new HashSet<>();
for (Entity entity : entities) {
@@ -204,9 +206,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.matches()) {
continue;
}
}
@@ -296,7 +298,8 @@ public class Section {
}
public void ignore(String type){
public void ignore(String type) {
entities.removeIf(entity -> entity.getType().equals(type));
}