Package generic.lsh.vector
Class HashEntry
java.lang.Object
generic.lsh.vector.HashEntry
-
Constructor Summary
ConstructorDescriptionHashEntry
(int h, int tcnt, double weight) Create a hash entry with an explicit weightHashEntry
(int h, int tcnt, int dcnt, WeightFactory w) Create a hash entry with a weight calculated from its term frequency and idf frequency -
Method Summary
Modifier and TypeMethodDescriptionboolean
Eclipse-generated equals function.double
getCoeff()
int
getHash()
short
getIDF()
short
getTF()
int
hashCode()
Eclipse-generated hash function.boolean
restoreBase64
(char[] buffer, int offset, int[] decoder, WeightFactory w, IDFLookup lookup) int
restoreSQL
(String sql, int start, WeightFactory w, IDFLookup lookup) void
restoreXml
(XmlPullParser parser, WeightFactory w) void
restoreXml
(XmlPullParser parser, WeightFactory w, IDFLookup lookup) Restore entry but recalculate the idfvoid
saveBase64
(char[] buffer, int offset, char[] encoder) void
saveSQL
(StringBuilder buf) void
-
Constructor Details
-
HashEntry
public HashEntry() -
HashEntry
public HashEntry(int h, int tcnt, double weight) Create a hash entry with an explicit weight- Parameters:
h
- is the 32-bit hashtcnt
- is the (optional) term-frequency count (set to 1 if not using)weight
- is the weight associated with the hash
-
HashEntry
Create a hash entry with a weight calculated from its term frequency and idf frequency- Parameters:
h
- is the 32-bit hashtcnt
- is the term frequency countdcnt
- is the (normalized) idf frequency (should be generated by an IDFLookup)w
- is the factory used to generate the final weight
-
-
Method Details
-
hashCode
public int hashCode()Eclipse-generated hash function. -
equals
Eclipse-generated equals function. -
getHash
public int getHash() -
getTF
public short getTF() -
getIDF
public short getIDF() -
getCoeff
public double getCoeff() -
saveXml
- Throws:
IOException
-
saveSQL
-
restoreXml
-
restoreXml
Restore entry but recalculate the idf- Parameters:
parser
- // xml statew
- // weight factory to calculate coefficient withlookup
- // lookup object to recalculate idf
-
restoreSQL
- Throws:
IOException
-
restoreBase64
public boolean restoreBase64(char[] buffer, int offset, int[] decoder, WeightFactory w, IDFLookup lookup) -
saveBase64
public void saveBase64(char[] buffer, int offset, char[] encoder)
-