Search in sources :

Example 1 with PunctuationFilter

use of com.twitter.common.text.filter.PunctuationFilter in project commons by twitter.

the class PunctuationExceptionCombinerTest method testPunctuationFilterDoesNotRemoveExceptionChars.

@Test
public void testPunctuationFilterDoesNotRemoveExceptionChars() {
    TwitterTokenStream stream = new PunctuationFilter(new PunctuationExceptionCombiner.Builder(tokenized).build());
    stream.reset("I .. exceptions!! ");
    assertEquals(ImmutableList.of("I", "exceptions"), stream.toStringList());
    stream.reset("I ♥♥ exceptions!!");
    assertEquals(ImmutableList.of("I", "♥♥", "exceptions"), stream.toStringList());
}
Also used : PunctuationFilter(com.twitter.common.text.filter.PunctuationFilter) TwitterTokenStream(com.twitter.common.text.token.TwitterTokenStream) Test(org.junit.Test)

Aggregations

PunctuationFilter (com.twitter.common.text.filter.PunctuationFilter)1 TwitterTokenStream (com.twitter.common.text.token.TwitterTokenStream)1 Test (org.junit.Test)1