Class LSHCosineVector

    • Constructor Detail

      • LSHCosineVector

        public LSHCosineVector()
      • LSHCosineVector

        public LSHCosineVector​(int[] feature,
                               WeightFactory wfactory,
                               IDFLookup idflookup)
        Install a set of features as an int[]. Each integer is a hash. The integers MUST already be sorted. The same integer can occur more than once in the array (term frequency (TF) > 1). Weights are determined by TF and Inverse Document Frequency (IDF) of individual features
        Parameters:
        feature - is the sorted array of integer hashes
        wfactory - is the container of weighting information
        idflookup - is the container of IDF information
    • Method Detail

      • hashCode

        public int hashCode()
        Uses the existing calcUniqueHash() method to determine hash value.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
      • equals

        public boolean equals​(java.lang.Object obj)
        Eclipse-generated equals method. Only the hash attribute is necessary.
        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj -
        Returns:
      • setHashEntries

        public void setHashEntries​(HashEntry[] entries)
        Install hashes and weights directly. Length is automatically calculated. The entries must already be sorted on the hash
        Parameters:
        entries -
      • restoreSQL

        public void restoreSQL​(java.lang.String sql,
                               WeightFactory wfactory,
                               IDFLookup idflookup)
                        throws java.io.IOException
        Specified by:
        restoreSQL in interface LSHVector
        Throws:
        java.io.IOException
      • restoreBase64

        public void restoreBase64​(java.io.Reader input,
                                  char[] buffer,
                                  WeightFactory wfactory,
                                  IDFLookup idflookup,
                                  int[] decode)
                           throws java.io.IOException
        Specified by:
        restoreBase64 in interface LSHVector
        Throws:
        java.io.IOException
      • saveXml

        public void saveXml​(java.io.Writer fwrite)
                     throws java.io.IOException
        Specified by:
        saveXml in interface LSHVector
        Throws:
        java.io.IOException
      • saveSQL

        public java.lang.String saveSQL()
        Specified by:
        saveSQL in interface LSHVector
      • saveBase64

        public void saveBase64​(java.lang.StringBuilder buffer,
                               char[] encoder)
        Specified by:
        saveBase64 in interface LSHVector