/**
* We don't support sub-language resources yet, so collect all variants for one language.
*/
private Map<Language, Set<String>> getLanguageToIgnoreTokensMapping() throws IOException {
final Map<Language, Set<String>> langToIgnoreTokens = new HashMap<>();
SuggestionExtractor extractor = new SuggestionExtractor();
for (Language lang : Language.REAL_LANGUAGES) {
final Set<String> suggestionTokens = new HashSet<>();
final JLanguageTool languageTool = new JLanguageTool(lang);
final Rule spellcheckRule = getSpellcheckRule(languageTool);
if (spellcheckRule == null) {
System.out.println("No spellchecker rule found for " + lang);
continue;
}
languageTool.activateDefaultPatternRules();
final List<Rule> rules = languageTool.getAllRules();
int tokenCount = 0;
int noErrorCount = 0;
for (Rule rule : rules) {
final List<String> tokens = extractor.getSuggestionTokens(rule, lang);
tokenCount += tokens.size();
for (String token : tokens) {
final AnalyzedSentence sentence = languageTool.getAnalyzedSentence(token);
final RuleMatch[] matches = spellcheckRule.match(sentence);
if (matches.length > 0) {