@Test void desuMasuStyle() throws RedPenException { Configuration config = Configuration.builder("ja") .addValidatorConfig(new ValidatorConfiguration("JapaneseStyle")) .build(); List<Document> documents = new ArrayList<>(); documents.add( Document.builder(new NeologdJapaneseTokenizer()) .addSection(1) .addParagraph() .addSentence(new Sentence("今日はいい天気ですね。", 1)) .addSentence(new Sentence("昨日は雨でしたが、持ち直しました。", 2)) .addSentence(new Sentence("明日もいい天気だといいですね。", 3)) .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) { boolean forceDearu = getBoolean("ForceDearu"); if (dearuCount > desumasuCount || forceDearu ) { detectPattern(sentence, DESUMASU_PATTERN); } else { detectPattern(sentence, DEARU_PATTERN); } }
JapaneseStyleValidator extends Validator { @Override public void validate(Sentence sentence) { boolean forceDearu = getBoolean("ForceDearu"); if (dearuCount > desumasuCount || forceDearu ) { detectPattern(sentence, DESUMASU_PATTERN); } else { detectPattern(sentence, DEARU_PATTERN); } } }
JapaneseStyleValidator extends Validator { @Override public void validate(Sentence sentence) { boolean forceDearu = getBoolean("ForceDearu"); if (dearuCount > desumasuCount || forceDearu ) { detectPattern(sentence, DESUMASU_PATTERN); } else { detectPattern(sentence, DEARU_PATTERN); } } JapaneseStyleValidator(); }
JapaneseStyleValidator extends Validator { @Override public void validate(Sentence sentence) { boolean forceDearu = getBoolean("ForceDearu"); if (dearuCount > desumasuCount || forceDearu ) { detectPattern(sentence, DESUMASU_PATTERN); } else { detectPattern(sentence, DEARU_PATTERN); } } JapaneseStyleValidator(); @Override void preValidate(Sentence sentence); @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages(); }
JapaneseStyleValidator extends Validator { @Override public void validate(Sentence sentence) { boolean forceDearu = getBoolean("ForceDearu"); if (dearuCount > desumasuCount || forceDearu ) { detectPattern(sentence, DESUMASU_PATTERN); } else { detectPattern(sentence, DEARU_PATTERN); } } JapaneseStyleValidator(); @Override void preValidate(Sentence sentence); @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages();  }