public class TermFrequency
extends java.lang.Object
Constructor and Description |
---|
TermFrequency()
Invokes the class with an empty list of term tuples
|
TermFrequency(java.util.List<TermFrequencyTuple> terms)
Invokes the class with an existing empty list of term tuples
|
Modifier and Type | Method and Description |
---|---|
void |
addTerm(java.lang.String term)
Add a term into the collection.
|
void |
addTerms(java.util.List<java.lang.String> terms)
Add these terms into the collection.
|
boolean |
existTerm(java.lang.String term) |
java.util.List<TermFrequencyTuple> |
getAll() |
TermFrequencyTuple |
getTerm(java.lang.String term) |
java.util.List<TermFrequencyTuple> |
getTop(int top,
int max)
Subset of terms with the highest tf up to top% or up to max
Note that not the top% is returned sometimes but a little bit more.
|
java.util.List<TermFrequencyTuple> |
getTopPlus(int top,
int max,
java.util.List<java.lang.String> catTerms)
Note that not the top% is returned sometimes but a little bit more.
|
void |
removeTerm(java.lang.String term)
Remove the given term (warning if the term does not exist)
|
void |
removeTerms(java.util.List<java.lang.String> terms)
Remove these terms into the collection.
|
int |
size() |
public TermFrequency()
public TermFrequency(java.util.List<TermFrequencyTuple> terms)
terms
- public boolean existTerm(java.lang.String term)
term
- public void addTerm(java.lang.String term)
term
- a non-null, non-empty stringpublic void removeTerm(java.lang.String term)
term
- non-null stringpublic void addTerms(java.util.List<java.lang.String> terms)
terms
- public void removeTerms(java.util.List<java.lang.String> terms)
terms
- public TermFrequencyTuple getTerm(java.lang.String term)
term
- public java.util.List<TermFrequencyTuple> getAll()
public java.util.List<TermFrequencyTuple> getTop(int top, int max)
top
- percentage of the terms to get (0 < top <=100)maximum
- number of terms allowed in the vocabulary (max > 1)
max=-1 indicates no maximum valuepublic java.util.List<TermFrequencyTuple> getTopPlus(int top, int max, java.util.List<java.lang.String> catTerms)
top
- percentage of the terms to get (0 < top <=100)public int size()