StopWord { public String remove(final String text) { StringBuilder result = new StringBuilder(text.length()); for (String word : text.split("\\s")) { String checkWord = normalize(word); if (!stopwords.contains(checkWord)) { result.append(word).append(" "); } } return result.toString().trim(); } StopWord(Path file);  StopWord(Path file, Charset charset); void caseSensitive(final boolean bool); void ignorePunctuation(final boolean bool); void load(); boolean isStopWord(final String token); boolean isStopWord(final String... token); boolean isStopWord(final List<String> token); boolean has(String text, LOCATION location); boolean has(String[] text, LOCATION location); boolean has(List<String> text, LOCATION location); boolean hasLeading(final String text); boolean hasLeading(final String... text); boolean hasLeading(final Collection<String> text); boolean hasTrailing(final String text); boolean hasTrailing(final String... text); boolean hasTrailing(final List<String> text); boolean hasEdge(final String text); boolean hasEdge(List<String> text); boolean hasEdge(String[] text); boolean contains(final String text); boolean contains(final String... text); boolean contains(final Collection<String> text); String remove(final String text); String[] remove(final String... text); List<String> remove(final Iterable<String> text); String remove(char[] text, LOCATION location); String remove(String text, LOCATION location); List<String> remove(List<String> text, LOCATION location); String[] remove(String[] text, LOCATION location); String removeLeading(String text); String[] removeLeading(String... text); List<String> removeLeading(Collection<String> text); String removeTrailing(String text); String[] removeTrailing(String... text); List<String> removeTrailing(List<String> text); String removeEdge(String text); String[] removeEdge(String... text); List<String> removeEdge(List<String> text);  }
@Test public void stopWordRemoveString() throws IOException { assertEquals(stopword.remove("the mountain"), "mountain"); }
@Test public void stopWordRemoveArray() throws IOException { assertArrayEquals(stopword.remove(new String[] { "the", "mountain" }), new String[] { "mountain" }); }
@Test public void stopWordRemoveArrayLocation() throws IOException { assertArrayEquals(stopword.remove(new String[] { "the", "mountain" }, StopWord.LOCATION.ANY), new String[] { "mountain" }); }
@Test public void stopWordRemoveLeadingStringLocation() throws IOException { assertEquals(stopword.remove("the mountain the", StopWord.LOCATION.LEADING), "mountain the"); }
@Test public void stopWordRemoveTrailingStringLocation() throws IOException { assertEquals(stopword.remove("the mountain the", StopWord.LOCATION.TRAILING), "the mountain"); }
@Test public void stopWordRemoveTrailingStringArrayLocation() throws IOException { assertArrayEquals(stopword.remove(new String[] { "the", "mountain", "the" }, StopWord.LOCATION.TRAILING), new String[] { "the", "mountain" }); }
@Test public void stopWordRemoveEdgeStringLocation() throws IOException { assertEquals(stopword.remove("the mountain the", StopWord.LOCATION.EDGE), "mountain"); }
@Test public void stopWordRemoveContainsStringLocationThusKill() throws IOException { assertEquals(stopword.remove("the mountain", StopWord.LOCATION.CONTAINS), ""); }