@Test void testLoadNotExistingDefaultDictionary() throws RedPenException { Configuration config = Configuration.builder("ja") .addValidatorConfig(new ValidatorConfiguration("LongKanjiChain")) .build(); List<Document> documents = new ArrayList<>();documents.add( Document.builder(new NeologdJapaneseTokenizer()) .addSection(1) .addParagraph() .addSentence(new Sentence("本日は晴天なり。", 1)) .build()); RedPen redPen = new RedPen(config); Map<Document, List<ValidationError>> errors = redPen.validate(documents); assertEquals(0, errors.get(documents.get(0)).size()); }
@Override public void validate(Sentence sentence) { final Matcher m = pat.matcher(sentence.getContent()); while (m.find()) { final String word = m.group(0); if (!inDictionary(word)) { addLocalizedError(sentence, word, word.length()); } } }
LongKanjiChainValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { final Matcher m = pat.matcher(sentence.getContent()); while (m.find()) { final String word = m.group(0); if (!inDictionary(word)) { addLocalizedError(sentence, word, word.length()); } } } }
LongKanjiChainValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { final Matcher m = pat.matcher(sentence.getContent()); while (m.find()) { final String word = m.group(0); if (!inDictionary(word)) { addLocalizedError(sentence, word, word.length()); } } } LongKanjiChainValidator(); }
LongKanjiChainValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { final Matcher m = pat.matcher(sentence.getContent()); while (m.find()) { final String word = m.group(0); if (!inDictionary(word)) { addLocalizedError(sentence, word, word.length()); } } } LongKanjiChainValidator(); @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages(); }
LongKanjiChainValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { final Matcher m = pat.matcher(sentence.getContent()); while (m.find()) { final String word = m.group(0); if (!inDictionary(word)) { addLocalizedError(sentence, word, word.length()); } } } LongKanjiChainValidator(); @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages();  }