org.apache.james.ai.classic
Class TokenCounter
java.lang.Object
org.apache.james.ai.classic.Tokenizer
org.apache.james.ai.classic.TokenCounter
public class TokenCounter
- extends Tokenizer
Counts tokens occuring in stream.
Totals are added to map.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TokenCounter
public TokenCounter(Map<String,Integer> countsByToken)
- Constructs a token counter to update values in given map.
- Parameters:
countsByToken
- counts for token indexed by token, not null
count
public TokenCounter count(Reader stream)
throws IOException
- Tokenizes and adds token counts to map.
- Parameters:
stream
- not null
- Returns:
- this, not null
- Throws:
IOException
next
protected void next(String token)
- Updates count for token in map.
- Specified by:
next
in class Tokenizer
- Parameters:
token
- not null
Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.