RED-2841: INC6207970 Rule for initials expansion should be applied only to dictionary entries without whitespaces
This commit is contained in:
parent
8d881d4ca6
commit
7198e1ae50
@ -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<Entity> 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;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user