@Test void testLoadNotExistingDefaultDictionary() throws RedPenException { Configuration config = Configuration.builder("ja") .addValidatorConfig(new ValidatorConfiguration("InvalidWord")) .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) { for (TokenElement token : sentence.getTokens()) { String word = token.getSurface().toLowerCase(); if (inDictionary(word)) { addLocalizedErrorFromToken(sentence, token); } } }
InvalidWordValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String word = token.getSurface().toLowerCase(); if (inDictionary(word)) { addLocalizedErrorFromToken(sentence, token); } } } }
InvalidWordValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String word = token.getSurface().toLowerCase(); if (inDictionary(word)) { addLocalizedErrorFromToken(sentence, token); } } } InvalidWordValidator(); }
InvalidWordValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String word = token.getSurface().toLowerCase(); if (inDictionary(word)) { addLocalizedErrorFromToken(sentence, token); } } } InvalidWordValidator(); @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence); }
InvalidWordValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String word = token.getSurface().toLowerCase(); if (inDictionary(word)) { addLocalizedErrorFromToken(sentence, token); } } } InvalidWordValidator(); @Override List<String> getSupportedLanguages(); @Override void validate(Sentence sentence);  }