}
protected List<RuleMatch> getRuleMatches(final String word, final int startPos) throws IOException {
final List<RuleMatch> ruleMatches = new ArrayList<>();
if (isMisspelled(speller1, word)) {
final RuleMatch ruleMatch = new RuleMatch(this, startPos, startPos
+ word.length(), messages.getString("spelling"),
messages.getString("desc_spelling_short"));
List<String> suggestions = speller1.getSuggestions(word);
if (suggestions.size() == 0 && word.length() >= 5) {
// speller1 uses a maximum edit distance of 1, it won't find suggestion for "garentee", "greatful" ezc.
suggestions.addAll(speller2.getSuggestions(word));
}
suggestions.addAll(0, getAdditionalTopSuggestions(suggestions, word));
suggestions.addAll(getAdditionalSuggestions(suggestions, word));
if (!suggestions.isEmpty()) {
ruleMatch.setSuggestedReplacements(orderSuggestions(suggestions, word));
}
ruleMatches.add(ruleMatch);
}
return ruleMatches;
}