List<String> suggestions = new ArrayList<>();
List<String> verbSuggestions = new ArrayList<>();
List<String> pronounSuggestions = new ArrayList<>();
RuleMatch ruleMatch;
if (subject.getStartPos() < verb.getStartPos()) {
ruleMatch = new RuleMatch(this, subject.getStartPos(), verb.getStartPos() + verb.getToken().length(), msg);
verbSuggestions.addAll(getVerbSuggestions(verb, expectedVerbPOS, false));
for (String verbSuggestion : verbSuggestions) {
suggestions.add(subject.getToken() + " " + verbSuggestion);
}
pronounSuggestions.addAll(getPronounSuggestions(verb, Character.isUpperCase(subject.getToken().charAt(0))));
for (String pronounSuggestion : pronounSuggestions) {
suggestions.add(pronounSuggestion + " " + verb.getToken());
}
ruleMatch.setSuggestedReplacements(suggestions);
} else {
ruleMatch = new RuleMatch(this, verb.getStartPos(), subject.getStartPos() + subject.getToken().length(), msg);
verbSuggestions.addAll(getVerbSuggestions(verb, expectedVerbPOS, Character.isUpperCase(verb.getToken().charAt(0))));
for (String verbSuggestion : verbSuggestions) {
suggestions.add(verbSuggestion + " " + subject.getToken());
}
pronounSuggestions.addAll(getPronounSuggestions(verb, false));
for (String pronounSuggestion : pronounSuggestions) {
suggestions.add(verb.getToken() + " " + pronounSuggestion);
}
ruleMatch.setSuggestedReplacements(suggestions);
}
return ruleMatch;
}