private void testBitextRulesFromXML(final Set<Language> ignoredLanguages) throws IOException {
for (final Language lang : Language.LANGUAGES) {
if (ignoredLanguages != null && ignoredLanguages.contains(lang)) {
continue;
}
final BitextPatternRuleLoader ruleLoader = new BitextPatternRuleLoader();
final String name = "/" + lang.getShortName() + "/bitext.xml";
final InputStream is;
try {
is = JLanguageTool.getDataBroker().getFromRulesDirAsStream(name);
} catch (RuntimeException ignored) {
// thrown if there is no bitext.xml file
continue;
}
System.out.println("Running tests for " + lang.getName() + "...");
final JLanguageTool languageTool = new JLanguageTool(lang);
final List<BitextPatternRule> rules = ruleLoader.getRules(is, name);
testBitextRulesFromXML(rules, languageTool, lang);
}
}