void (@Nullable String text, @NotNull TextRange range, Consumer<TextRange> consumer) { if (text == null || range.getLength() < 1 || range.getStartOffset() < 0) { return; } List<TextRange> extracted = excludeByPattern(text, range, WORD_IN_QUOTES, 1); for (TextRange textRange : extracted) { List<TextRange> words = splitByCase(text, textRange); if (words.size() == 0) { continue; } if (words.size() == 1) { addWord(consumer, false, words.get(0)); continue; } boolean isCapitalized = Strings.isCapitalized(text, words.get(0)); boolean containsShortWord = containsShortWord(words); if (isCapitalized && containsShortWord) { continue; } boolean isAllWordsAreUpperCased = isAllWordsAreUpperCased(text, words); for (TextRange word : words) { boolean uc = Strings.isUpperCased(text, word); boolean flag = (uc && !isAllWordsAreUpperCased); try { Matcher matcher = WORD.matcher(newBombedCharSequence(word.substring(text))); if (matcher.find()) { TextRange found = matcherRange(word, matcher); addWord(consumer, flag, found); } } catch (ProcessCanceledException e) { return; } } } }