|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectit.unimi.dsi.mg4j.index.AbstractTermMap
it.unimi.dsi.mg4j.util.MinimalPerfectHash
it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash
it.unimi.dsi.mg4j.util.HashCodeSignedMinimalPerfectHash
String.hashCode()
-signed order-preserving minimal perfect hash tables.
This class source exemplifies a signed minimal perfect hash table that
signes each word with the hash code that would be returned by
String.hashCode()
if the word were a String
, thus avoiding false positives with high
probability.
Field Summary |
Fields inherited from class it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash |
serialVersionUID |
Fields inherited from class it.unimi.dsi.mg4j.util.MinimalPerfectHash |
g, m, n, n4, rightShift, t, TERM_THRESHOLD, terms, VERBOSE, WEIGHT_UNKNOWN, WEIGHT_UNKNOWN_SORTED_TERMS, weight0, weight1, weight2, weightLength |
Constructor Summary | |
HashCodeSignedMinimalPerfectHash(Collection words)
Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the given
set of words, using as many weights as the longest word in the collection. |
|
HashCodeSignedMinimalPerfectHash(Collection words,
int weightLength)
Creates a new String.hashCode() -signed order-preserving minimal perfect hash table
for the given set of words using the given number of weights. |
|
HashCodeSignedMinimalPerfectHash(String wordFile)
Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for
the given file of words, using as many weights as the longest word in the file. |
|
HashCodeSignedMinimalPerfectHash(String wordFile,
String encoding,
int weightLength)
Creates a new String.hashCode() -signed order-preserving minimal perfect hash table for the given file
of words using the given number of weights. |
Method Summary | |
boolean |
checkSignature(CharSequence word,
int index)
Checks a signature. |
void |
initSignatures(Collection words)
Sets up the signature system from a collection. |
Methods inherited from class it.unimi.dsi.mg4j.util.SignedMinimalPerfectHash |
get |
Methods inherited from class it.unimi.dsi.mg4j.util.MinimalPerfectHash |
get, getFromT, getWeightLength, hash, hash, hash, main, size, weightLength |
Methods inherited from class it.unimi.dsi.mg4j.index.AbstractTermMap |
get, get |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public HashCodeSignedMinimalPerfectHash(Collection words, int weightLength)
String.hashCode()
-signed order-preserving minimal perfect hash table
for the given set of words using the given number of weights.
words
- some words to hash; it is assumed that this Collection
does not contain words with a common prefix of
weightLength
characters.weightLength
- the number of weights used generating the
intermediate hash functions.MinimalPerfectHash.MinimalPerfectHash(Collection,int)
public HashCodeSignedMinimalPerfectHash(Collection words)
String.hashCode()
-signed order-preserving minimal perfect hash table for the given
set of words, using as many weights as the longest word in the collection.
words
- some words to hash; it is assumed that this Collection
does not contain duplicates.MinimalPerfectHash.MinimalPerfectHash(Collection)
public HashCodeSignedMinimalPerfectHash(String wordFile, String encoding, int weightLength)
String.hashCode()
-signed order-preserving minimal perfect hash table for the given file
of words using the given number of weights.
wordFile
- an UTF-8 file containing one word on each line; it is assumed that
it does not contain words with a common prefix of
weightLength
characters.encoding
- the encoding of wordFile
; if null
, it
is assumed to be the platform default encoding.weightLength
- the number of weights used generating the
intermediate hash functions.MinimalPerfectHash.MinimalPerfectHash(String,String,int)
public HashCodeSignedMinimalPerfectHash(String wordFile)
String.hashCode()
-signed order-preserving minimal perfect hash table for
the given file of words, using as many weights as the longest word in the file.
wordFile
- a file in the platform default encoding containing one word on each line; it is assumed that the file does
not contain twice the same word.MinimalPerfectHash.MinimalPerfectHash(String)
Method Detail |
public void initSignatures(Collection words)
SignedMinimalPerfectHash
This abstract method must be overriden by implementing subclasses. It must set up all data structures that are necessary to handle signatures; in particular, it will usually compute signatures for all terms in the given collection.
initSignatures
in class SignedMinimalPerfectHash
words
- the collection of terms given to the constructor of this class.CRC32SignedMinimalPerfectHash.initSignatures(Collection)
,
LiterallySignedMinimalPerfectHash.initSignatures(Collection)
public boolean checkSignature(CharSequence word, int index)
SignedMinimalPerfectHash
This abstract method must be overriden by implementing subclasses.
It must check whether the signature of the given character sequence matches
the one stored for the index
-th term.
checkSignature
in class SignedMinimalPerfectHash
word
- a character sequence.index
- an integer denoting a term in the indexed collection.
index
-th term.CRC32SignedMinimalPerfectHash.checkSignature(CharSequence,int)
,
LiterallySignedMinimalPerfectHash.checkSignature(CharSequence,int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |