private void run(String filename) throws IOException {
Map<String, ConfusionProbabilityRule.ConfusionSet> confusionSet = getConfusionSet();
try (FileReader reader = new FileReader(filename)) {
String text = StringTools.readerToString(reader);
JLanguageTool languageTool = new JLanguageTool(new English());
List<AnalyzedSentence> analyzedSentences = languageTool.analyzeText(text);
for (AnalyzedSentence sentence : analyzedSentences) {
runOnSentence(sentence, confusionSet);
}
}
System.out.println("Homophones set: " + confusionSet.size() + " items");