Methods Summary |
---|
public void | setUp()
input = new StringReader("abcde");
|
public void | testBackUnigram()
EdgeNGramTokenizer tokenizer = new EdgeNGramTokenizer(input, EdgeNGramTokenizer.Side.BACK, 1);
Token token = null;
token = tokenizer.next();
assertEquals("(e,4,5)", token.toString());
token = tokenizer.next();
assertNull(token);
|
public void | testFrontUnigram()
EdgeNGramTokenizer tokenizer = new EdgeNGramTokenizer(input, EdgeNGramTokenizer.Side.FRONT, 1);
Token token = null;
token = tokenizer.next();
assertEquals("(a,0,1)", token.toString());
token = tokenizer.next();
assertNull(token);
|
public void | testInvalidInput()
boolean gotException = false;
try {
new EdgeNGramTokenizer(input, EdgeNGramTokenizer.Side.FRONT, 0);
} catch (IllegalArgumentException e) {
gotException = true;
}
assertTrue(gotException);
|
public void | testInvalidInput2()
boolean gotException = false;
try {
new EdgeNGramTokenizer(input, EdgeNGramTokenizer.Side.FRONT, -1);
} catch (IllegalArgumentException e) {
gotException = true;
}
assertTrue(gotException);
|
public void | testOversizedNgrams()
EdgeNGramTokenizer tokenizer = new EdgeNGramTokenizer(input, EdgeNGramTokenizer.Side.FRONT, 6);
Token token = null;
token = tokenizer.next();
assertNull(token);
|