@Test void testSingleSentence() { KatakanaSpellCheckValidator validator = new KatakanaSpellCheckValidator(); Sentence st = new Sentence("ハロー、ハロ。" + "あのインデクスとこのインデックス" , 0); List<ValidationError> errors = new ArrayList<>(); validator.setErrorList(errors); validator.validate(st); assertEquals(1, errors.size(), st.toString()); }
@Override public void validate(Sentence sentence) { StringBuilder katakana = new StringBuilder(); for (int i = 0; i < sentence.getContent().length(); i++) { char c = sentence.getContent().charAt(i); if (StringUtils.isKatakana(c)) { katakana.append(c); } else { this.checkKatakanaSpell(sentence, katakana.toString()); katakana.delete(0, katakana.length()); } } checkKatakanaSpell(sentence, katakana.toString()); }
KatakanaSpellCheckValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { StringBuilder katakana = new StringBuilder(); for (int i = 0; i < sentence.getContent().length(); i++) { char c = sentence.getContent().charAt(i); if (StringUtils.isKatakana(c)) { katakana.append(c); } else { this.checkKatakanaSpell(sentence, katakana.toString()); katakana.delete(0, katakana.length()); } } checkKatakanaSpell(sentence, katakana.toString()); } }
KatakanaSpellCheckValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { StringBuilder katakana = new StringBuilder(); for (int i = 0; i < sentence.getContent().length(); i++) { char c = sentence.getContent().charAt(i); if (StringUtils.isKatakana(c)) { katakana.append(c); } else { this.checkKatakanaSpell(sentence, katakana.toString()); katakana.delete(0, katakana.length()); } } checkKatakanaSpell(sentence, katakana.toString()); } KatakanaSpellCheckValidator(); }
KatakanaSpellCheckValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { StringBuilder katakana = new StringBuilder(); for (int i = 0; i < sentence.getContent().length(); i++) { char c = sentence.getContent().charAt(i); if (StringUtils.isKatakana(c)) { katakana.append(c); } else { this.checkKatakanaSpell(sentence, katakana.toString()); katakana.delete(0, katakana.length()); } } checkKatakanaSpell(sentence, katakana.toString()); } KatakanaSpellCheckValidator(); @Override List<String> getSupportedLanguages(); @Override void preValidate(Sentence sentence); @Override void validate(Sentence sentence); }
KatakanaSpellCheckValidator extends DictionaryValidator { @Override public void validate(Sentence sentence) { StringBuilder katakana = new StringBuilder(); for (int i = 0; i < sentence.getContent().length(); i++) { char c = sentence.getContent().charAt(i); if (StringUtils.isKatakana(c)) { katakana.append(c); } else { this.checkKatakanaSpell(sentence, katakana.toString()); katakana.delete(0, katakana.length()); } } checkKatakanaSpell(sentence, katakana.toString()); } KatakanaSpellCheckValidator(); @Override List<String> getSupportedLanguages(); @Override void preValidate(Sentence sentence); @Override void validate(Sentence sentence);  }