public class TokenCounter extends Object
| Constructor and Description |
|---|
TokenCounter()
Creates a new token counter
|
TokenCounter(boolean doLowerCasing)
Creates a new token counter that optionally lower cases tokens
|
| Modifier and Type | Method and Description |
|---|---|
Map<String,Integer> |
getTokenCounts()
Returns a mapping from each seen token to the number of times it occurred
|
static void |
main(String[] args) |
void |
process(BufferedReader br)
Counts all of the tokens in the reader
|
void |
process(String tokens)
Counts all of the tokens in the string
|
void |
processFile(File file)
Counts all of the tokens in the file
|
void |
processFile(String fileName)
Counts all of the tokens in the file with specified name
|
public TokenCounter()
public TokenCounter(boolean doLowerCasing)
doLowerCasing - true if the token counter should lower case
all tokens before countingpublic Map<String,Integer> getTokenCounts()
public void processFile(String fileName) throws IOException
IOExceptionpublic void processFile(File file) throws IOException
IOExceptionpublic void process(BufferedReader br)
public void process(String tokens)
public static void main(String[] args)
Copyright © 2012. All Rights Reserved.