use of org.languagetool.rules.spelling.CachingWordListLoader in project languagetool by languagetool-org.
the class WordListValidatorTest method testWordListValidity.
@Test
public void testWordListValidity() throws IOException {
Set<String> checked = new HashSet<>();
for (Language lang : Languages.get()) {
if (lang.getShortCode().equals("ru")) {
// skipping, Cyrillic chars not part of the validation yet
continue;
}
JLanguageTool lt = new JLanguageTool(lang);
List<Rule> rules = lt.getAllActiveRules();
for (Rule rule : rules) {
if (rule instanceof SpellingCheckRule) {
SpellingCheckRule sRule = (SpellingCheckRule) rule;
String file = sRule.getSpellingFileName();
if (JLanguageTool.getDataBroker().resourceExists(file) && !checked.contains(file)) {
System.out.println("Checking " + file);
CachingWordListLoader loader = new CachingWordListLoader();
List<String> words = loader.loadWords(file);
validateWords(words, file);
checked.add(file);
}
}
}
}
}
Aggregations