@Test void stemPhrase() { assertEquals("i like smoke", cleanStemPhrase("i like smoking!")); assertEquals("it not possibl", cleanStemPhrase("it`s not possibilities!")); }
public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { stringBuilder.append(' '); } stringBuilder.append(stemmedWord); } } return stringBuilder.toString(); }
Stemmer { public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { stringBuilder.append(' '); } stringBuilder.append(stemmedWord); } } return stringBuilder.toString(); } }
Stemmer { public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { stringBuilder.append(' '); } stringBuilder.append(stemmedWord); } } return stringBuilder.toString(); } private  Stemmer(); }
Stemmer { public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { stringBuilder.append(' '); } stringBuilder.append(stemmedWord); } } return stringBuilder.toString(); } private  Stemmer(); static String cleanStemPhrase(String phrase); static String stem(String word); static String stemAndJoin(Set<String> terms); static String replaceIllegalCharacter(String string); }
Stemmer { public static String cleanStemPhrase(String phrase) { StringBuilder stringBuilder = new StringBuilder(); for (String word : replaceIllegalCharacter(phrase).split(" ")) { String stemmedWord = stem(word); if (StringUtils.isNotEmpty(stemmedWord)) { if (stringBuilder.length() > 0) { stringBuilder.append(' '); } stringBuilder.append(stemmedWord); } } return stringBuilder.toString(); } private  Stemmer(); static String cleanStemPhrase(String phrase); static String stem(String word); static String stemAndJoin(Set<String> terms); static String replaceIllegalCharacter(String string);  }