Package generic.lsh.vector
Class HashEntry
java.lang.Object
generic.lsh.vector.HashEntry
-
Constructor Summary
ConstructorsConstructorDescriptionHashEntry(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 TypeMethodDescriptionbooleanEclipse-generated equals function.doublegetCoeff()intgetHash()shortgetIDF()shortgetTF()inthashCode()Eclipse-generated hash function.booleanrestoreBase64(char[] buffer, int offset, int[] decoder, WeightFactory w, IDFLookup lookup) intrestoreSQL(String sql, int start, WeightFactory w, IDFLookup lookup) voidrestoreXml(XmlPullParser parser, WeightFactory w) voidrestoreXml(XmlPullParser parser, WeightFactory w, IDFLookup lookup) Restore entry but recalculate the idfvoidsaveBase64(char[] buffer, int offset, char[] encoder) voidsaveSQL(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)
-