@Test void testUserSkipList() throws RedPenException { config = Configuration.builder() .addValidatorConfig(new ValidatorConfiguration(validatorName).addProperty("list", "abeshi,baz")) .build(); Document document = prepareSimpleDocument("Abeshi is a word used in a comic."); RedPen redPen = new RedPen(config); Map<Document, List<ValidationError>> errors = redPen.validate(singletonList(document)); assertEquals(0, errors.get(document).size()); }
@Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String surface = token.getSurface().toLowerCase(); if (surface.length() == 0 || surface.matches("\\P{L}+")) continue; if (dictionaryExists() && !inDictionary(surface)) { addLocalizedErrorFromToken(sentence, token); } } }
SpellingValidator extends SpellingDictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String surface = token.getSurface().toLowerCase(); if (surface.length() == 0 || surface.matches("\\P{L}+")) continue; if (dictionaryExists() && !inDictionary(surface)) { addLocalizedErrorFromToken(sentence, token); } } } }
SpellingValidator extends SpellingDictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String surface = token.getSurface().toLowerCase(); if (surface.length() == 0 || surface.matches("\\P{L}+")) continue; if (dictionaryExists() && !inDictionary(surface)) { addLocalizedErrorFromToken(sentence, token); } } }  }
SpellingValidator extends SpellingDictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String surface = token.getSurface().toLowerCase(); if (surface.length() == 0 || surface.matches("\\P{L}+")) continue; if (dictionaryExists() && !inDictionary(surface)) { addLocalizedErrorFromToken(sentence, token); } } }  @Override void validate(Sentence sentence); }
SpellingValidator extends SpellingDictionaryValidator { @Override public void validate(Sentence sentence) { for (TokenElement token : sentence.getTokens()) { String surface = token.getSurface().toLowerCase(); if (surface.length() == 0 || surface.matches("\\P{L}+")) continue; if (dictionaryExists() && !inDictionary(surface)) { addLocalizedErrorFromToken(sentence, token); } } }  @Override void validate(Sentence sentence);  }