| Constructor and Description |
|---|
WordBag(String bagLabel)
Constructor.
|
WordBag(String bagName,
HashMap<String,Integer> words)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addWord(String word)
Add the word into the bag.
|
void |
addWord(String word,
Integer frequency)
Add the word into the dictionary.
|
WordBag |
clone() |
boolean |
contains(String word)
Quick check if the word is in the text.
|
double |
getAverageFrequency()
Get the maximal observed frequency.
|
HashMap<String,AtomicInteger> |
getInternalWords()
Get the words collection along with frequencies.
|
String |
getLabel()
Get the wordbag id or name.
|
int |
getMaxFrequency()
Get the maximal observed frequency.
|
int |
getTotalWordCount()
Integral of all frequency values.
|
Integer |
getWordFrequency(String word)
Get the word occurrence frequency, if word is not in returns 0.
|
HashMap<String,Integer> |
getWords()
Get the words collection along with frequencies.
|
HashMap<String,Double> |
getWordsAsDoubles()
Get the words collection along with frequencies.
|
Collection<String> |
getWordSet()
Get the words set.
|
void |
mergeWith(WordBag otherBag)
Implements merge operation for this bag with some other bag.
|
void |
setLabel(String newBagLabel)
Set the new label on this bag.
|
String |
toColumn() |
String |
toString() |
public WordBag(String bagLabel)
bagLabel - The name for the collection.public void setLabel(String newBagLabel)
newBagLabel - The new label.public String getLabel()
public void addWord(String word)
word - The word to add.public void addWord(String word, Integer frequency)
word - The word.frequency - Word's frequency.public Integer getWordFrequency(String word)
word - The word to look for.public boolean contains(String word)
word - The word to check for.public Collection<String> getWordSet()
public HashMap<String,Double> getWordsAsDoubles()
public HashMap<String,Integer> getWords()
public HashMap<String,AtomicInteger> getInternalWords()
public int getTotalWordCount()
public void mergeWith(WordBag otherBag)
otherBag - The bag to merge with.public String toColumn()
public int getMaxFrequency()
public double getAverageFrequency()
Copyright © 2021. All rights reserved.