|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ir.vsr.HashMapVector
A data structure for a term vector for a document stored as a HashMap that maps tokens to Weight's that store the weight of that token in the document. Needed as an efficient, indexed representation of sparse document vectors.
Field Summary | |
java.util.HashMap |
hashMap
The HashMap that stores the mapping of tokens to Weight's |
Constructor Summary | |
HashMapVector()
|
Method Summary | |
void |
add(HashMapVector vector)
Destructively add the given vector to the current vector |
HashMapVector |
copy()
Produce a copy of this HashMapVector with a new HashMap and new Weight's |
double |
cosineDistanceTo(HashMapVector otherVector)
|
double |
increment(java.lang.String token)
Increment the weight for the given token in the vector by 1. |
double |
increment(java.lang.String token,
double amount)
Increment the weight for the given token in the vector by the given amount. |
double |
increment(java.lang.String token,
int amount)
Increment the weight for the given token in the vector by the given int |
java.util.Iterator |
iterator()
Returns an iterator over the MapEntries in the hashMap |
double |
maxWeight()
Returns the maximum weight of any token in the vector. |
void |
multiply(double factor)
Destructively multiply the vector by a constant |
void |
print()
Print out the vector showing the tokens and their weights |
int |
size()
Returns the number of tokens in the vector. |
void |
subtract(HashMapVector vector)
Destructively subtract the given vector from the current vector |
java.lang.String |
toString()
Return String of the vector showing the tokens and their weights |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public java.util.HashMap hashMap
Constructor Detail |
public HashMapVector()
Method Detail |
public java.util.Iterator iterator()
public int size()
public double increment(java.lang.String token, double amount)
public double increment(java.lang.String token)
public double increment(java.lang.String token, int amount)
public void add(HashMapVector vector)
public void subtract(HashMapVector vector)
public void multiply(double factor)
public HashMapVector copy()
public double maxWeight()
public void print()
public java.lang.String toString()
toString
in class java.lang.Object
public double cosineDistanceTo(HashMapVector otherVector)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |