public class WordCountExtractor
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
uniqueWords
String array of unique words.
|
protected java.util.Map<java.lang.String,java.lang.Integer> |
wordCounts
The list of words and word counts in the text.
|
(package private) java.lang.String[] |
words
The text parsed into a string array of words.
|
Constructor and Description |
---|
WordCountExtractor()
Create word count extractor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
computeWordCounts()
Compute word counts from a string array of words.
|
void |
countWords(java.util.List<java.lang.String> wordList)
Extract word counts from an arraylist of words.
|
void |
countWords(java.lang.String[] words)
Extract word counts from a string array of words.
|
int |
getNumberOfUniqueWords()
Return the number of unique words.
|
int |
getNumberOfWords()
Return the total number of words.
|
java.lang.String[] |
getUniqueWords()
Return unique words as a string array.
|
int |
getWordCount(java.lang.String word)
Return count for a specific word.
|
java.util.Map |
getWordCounts()
Return word count map.
|
java.lang.String[] |
getWords()
Return tokenized text words as a string array.
|
void |
reset()
Reset counter.
|
protected java.util.Map<java.lang.String,java.lang.Integer> wordCounts
Key=word
Value=Integer(count)
java.lang.String[] words
protected java.lang.String[] uniqueWords
public void countWords(java.lang.String[] words)
words
- The string array with the words.public void countWords(java.util.List<java.lang.String> wordList)
wordList
- The list with the words.protected void computeWordCounts()
public java.lang.String[] getWords()
public int getNumberOfWords()
public java.lang.String[] getUniqueWords()
public int getNumberOfUniqueWords()
public int getWordCount(java.lang.String word)
word
- The word whose count is desired.public java.util.Map getWordCounts()
public void reset()