Returns the next token in the stream, or null at EOS.
/// Removes 's from the end of words.
///
Removes dots from acronyms.
///
public override Token Next(Token result)
{
Token t = input.Next(result);
if (t == null)
return null;
char[] buffer = t.TermBuffer();
int bufferLength = t.TermLength();
System.String type = t.Type();
if (type == APOSTROPHE_TYPE && bufferLength >= 2 && buffer[bufferLength - 2] == '\'' && (buffer[bufferLength - 1] == 's' || buffer[bufferLength - 1] == 'S'))
{
// Strip last 2 characters off
t.SetTermLength(bufferLength - 2);
}
else if (type == ACRONYM_TYPE)
{
// remove dots
int upto = 0;
for (int i = 0; i < bufferLength; i++)
{
char c = buffer[i];
if (c != '.')
buffer[upto++] = c;
}
t.SetTermLength(upto);
}
return t;
}
static StandardFilter()
{
APOSTROPHE_TYPE = StandardTokenizerImpl.TOKEN_TYPES[StandardTokenizerImpl.APOSTROPHE];
ACRONYM_TYPE = StandardTokenizerImpl.TOKEN_TYPES[StandardTokenizerImpl.ACRONYM];
}
}
}