@Test void testValid() throws Exception { List<Document> documents = new ArrayList<>(); documents.add(Document.builder(new NeologdJapaneseTokenizer()) .addSection(1) .addParagraph() .addSentence(new Sentence("今日は早朝から出発したことで、定刻通りではなかったが、無事会場に到着した。", 1)) .build()); Configuration config = Configuration.builder("ja") .addValidatorConfig(new ValidatorConfiguration("DoubledConjunctiveParticleGa")) .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) { List<TokenElement> vec = new ArrayList<>(); for (TokenElement el : sentence.getTokens()) { final List<String> t = el.getTags(); final String s = el.getSurface(); if (t.get(0).equals("助詞") && t.get(1).equals("接続助詞") && s.equals("が")) { vec.add(el); } } if (vec.size() > 1) { addLocalizedError(sentence, vec.get(0).getSurface()); } }
DoubledConjunctiveParticleGaValidator extends Validator { @Override public void validate(Sentence sentence) { List<TokenElement> vec = new ArrayList<>(); for (TokenElement el : sentence.getTokens()) { final List<String> t = el.getTags(); final String s = el.getSurface(); if (t.get(0).equals("助詞") && t.get(1).equals("接続助詞") && s.equals("が")) { vec.add(el); } } if (vec.size() > 1) { addLocalizedError(sentence, vec.get(0).getSurface()); } } }
DoubledConjunctiveParticleGaValidator extends Validator { @Override public void validate(Sentence sentence) { List<TokenElement> vec = new ArrayList<>(); for (TokenElement el : sentence.getTokens()) { final List<String> t = el.getTags(); final String s = el.getSurface(); if (t.get(0).equals("助詞") && t.get(1).equals("接続助詞") && s.equals("が")) { vec.add(el); } } if (vec.size() > 1) { addLocalizedError(sentence, vec.get(0).getSurface()); } }  }
DoubledConjunctiveParticleGaValidator extends Validator { @Override public void validate(Sentence sentence) { List<TokenElement> vec = new ArrayList<>(); for (TokenElement el : sentence.getTokens()) { final List<String> t = el.getTags(); final String s = el.getSurface(); if (t.get(0).equals("助詞") && t.get(1).equals("接続助詞") && s.equals("が")) { vec.add(el); } } if (vec.size() > 1) { addLocalizedError(sentence, vec.get(0).getSurface()); } }  @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages(); }
DoubledConjunctiveParticleGaValidator extends Validator { @Override public void validate(Sentence sentence) { List<TokenElement> vec = new ArrayList<>(); for (TokenElement el : sentence.getTokens()) { final List<String> t = el.getTags(); final String s = el.getSurface(); if (t.get(0).equals("助詞") && t.get(1).equals("接続助詞") && s.equals("が")) { vec.add(el); } } if (vec.size() > 1) { addLocalizedError(sentence, vec.get(0).getSurface()); } }  @Override void validate(Sentence sentence); @Override List<String> getSupportedLanguages();  }