use of org.languagetool.language.BritishEnglish in project languagetool by languagetool-org.
the class JLanguageToolTest method spellCheckerDemoCodeForHomepageWithAddedWords.
@Ignore("not a test, but used on http://wiki.languagetool.org/java-spell-checker")
@Test
public void spellCheckerDemoCodeForHomepageWithAddedWords() throws IOException {
JLanguageTool langTool = new JLanguageTool(new BritishEnglish());
for (Rule rule : langTool.getAllRules()) {
if (rule instanceof SpellingCheckRule) {
((SpellingCheckRule) rule).addIgnoreTokens(Arrays.asList("myspecialword", "anotherspecialword"));
}
}
List<RuleMatch> matches = langTool.check("These are myspecialword and anotherspecialword");
// => "0 matches"
System.out.println(matches.size() + " matches");
}
Aggregations