public class ContextVector
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
class |
ContextVector.Entry |
Constructor and Description |
---|
ContextVector()
Default constructor for
ContextVector . |
ContextVector(Term term)
Construct a context vector with a back reference to its owner term.
|
ContextVector(Term term,
boolean useTermClasses)
Construct a context vector with a back reference to its owner term.
|
Modifier and Type | Method and Description |
---|---|
void |
addAllCooccurrences(java.util.Iterator<TermOccurrence> it) |
void |
addCooccurrence(TermOccurrence occ) |
void |
addEntry(Term coTerm,
int nbCooccs,
double assocRate) |
boolean |
equals(java.lang.Object obj) |
double |
getAssocRate(Term term) |
java.util.List<ContextVector.Entry> |
getEntries()
Gives the list of terms in this context vector sorted by frequency
(most frequent first)
|
int |
getNbCooccs(Term term) |
Term |
getTerm() |
int |
getTotalCoccurrences() |
int |
hashCode() |
void |
normalize()
Normalizes all
assocRates so that their sum is 1 |
void |
removeCoTerm(Term term) |
java.util.Set<Term> |
terms() |
void |
toAssocRateVector(CrossTable table,
AssociationRate assocRateFunction,
boolean normalize)
Normalize this vector according to a cross table
and an association rate measure.
|
java.lang.String |
toString() |
public ContextVector()
ContextVector
. Must be used if no normalization is required.public ContextVector(Term term, boolean useTermClasses)
term
- the owner termuseTermClasses
- if true
, builds this context vector with term
classes instead of termstoAssocRateVector(CrossTable, AssociationRate, boolean)
public ContextVector(Term term)
term
- the owner termtoAssocRateVector(CrossTable, AssociationRate, boolean)
public void addAllCooccurrences(java.util.Iterator<TermOccurrence> it)
public void addCooccurrence(TermOccurrence occ)
public void addEntry(Term coTerm, int nbCooccs, double assocRate)
public void removeCoTerm(Term term)
public java.util.List<ContextVector.Entry> getEntries()
public void normalize()
assocRates
so that their sum is 1public int getNbCooccs(Term term)
public double getAssocRate(Term term)
public java.util.Set<Term> terms()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public Term getTerm()
public void toAssocRateVector(CrossTable table, AssociationRate assocRateFunction, boolean normalize)
ContextVector.Entry
.frequency
values
with the normalized ones.table
- the pre-computed co-occurrences CrossTable
assocRateFunction
- the AssociationRate
measure implementationnormalize
- public java.lang.String toString()
toString
in class java.lang.Object
public int getTotalCoccurrences()