Package generic.lsh.vector
Class HashEntry
- java.lang.Object
-
- generic.lsh.vector.HashEntry
-
public class HashEntry extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description HashEntry()
HashEntry(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
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(java.lang.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(java.lang.StringBuilder buf)
void
saveXml(java.io.Writer fwrite)
-
-
-
Constructor Detail
-
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
public HashEntry(int h, int tcnt, int dcnt, WeightFactory w)
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 Detail
-
hashCode
public int hashCode()
Eclipse-generated hash function.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
-
equals
public boolean equals(java.lang.Object obj)
Eclipse-generated equals function.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
-- Returns:
-
getHash
public int getHash()
-
getTF
public short getTF()
-
getIDF
public short getIDF()
-
getCoeff
public double getCoeff()
-
saveXml
public void saveXml(java.io.Writer fwrite) throws java.io.IOException
- Throws:
java.io.IOException
-
saveSQL
public void saveSQL(java.lang.StringBuilder buf)
-
restoreXml
public void restoreXml(XmlPullParser parser, WeightFactory w)
-
restoreXml
public void restoreXml(XmlPullParser parser, WeightFactory w, IDFLookup lookup)
Restore entry but recalculate the idf- Parameters:
parser
- // xml statew
- // weight factory to calculate coefficient withlookup
- // lookup object to recalculate idf
-
restoreSQL
public int restoreSQL(java.lang.String sql, int start, WeightFactory w, IDFLookup lookup) throws java.io.IOException
- Throws:
java.io.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)
-
-