# Path: lsh/lsh/lsh_base.py
# class LshBase(object):
# 
#     def run(self, docuemnt):
#         raise NotImplementedError("Subclasses should implement run()")
# 
# Path: lsh/utils/similarity.py
# def jaccard_similarity(set1, set2):
#     return __calculate_jaccard_similairty(set1, set2)
# 
# Path: lsh/utils/similarity.py
# def compute_positive_hash(value):
#     return hash(value) % ((sys.maxsize + 1) * 2)
# 
# Path: lsh/models/documents/jaccard_document.py
# class JaccardDocument(DocumentBase):
#     """
#         This class represents documents used in LSH families for Jaccard Distance
#         based implementations and their corresponding components in this platform.
#     """
# 
#     def __init__(self, original_doc, shingles_list=None, minhash_signatures=None):
#         self.__shingles = shingles_list
#         self.__signatures = minhash_signatures
# 
#         super(JaccardDocument, self).__init__(original_doc)
# 
#     def get_signatures_list(self):
#         return self.__signatures
# 
#     def get_shingles_list(self):
#         return self.__shingles
# 
#     def set_signatures_list(self, value):
#         self.__signatures = value
# 
#     def set_shingles_lists(self, value):
#         self.__shingles = value
# 
#     def get_shingles_as_set(self):
#         return set(self.__shingles)


from lsh.lsh.lsh_base import LshBase
from lsh.utils.similarity import jaccard_similarity
from lsh.utils.similarity import compute_positive_hash
from lsh.models.documents.jaccard_document import JaccardDocument
import copy


    #--- helper functions ----

    def _build_results_dict(self, score, match_found, doc_1, doc_2, band_matched):
        """
            Build LSH results dictionary.
            :param score:
            :param match_found:
            :param doc_1:
            :param doc_2:
            :return: results dict that contains candidate documents, threshold and LSH similarity score.
        """
        results_dict = {"score": score,
                        "match_found": match_found,
                        "document_1": doc_1,
                        "document_2": doc_2,
                        "threshold": self.threshold,
                        "band_matched": band_matched}
        return results_dict

    #TODO refactor so that users can specify their own hashing function(s)
    def _calculate_hash(self, obj):
        """
            This method computes hash of object using a dynamic hashing function.
            :param obj: object we are computing hash code for.
            :return: hash code (long integer)
        """

        # hash value to positive integer

# Path: lsh/lsh/lsh_base.py
# class LshBase(object):
# 
#     def run(self, docuemnt):
#         raise NotImplementedError("Subclasses should implement run()")
# 
# Path: lsh/utils/similarity.py
# def jaccard_similarity(set1, set2):
#     return __calculate_jaccard_similairty(set1, set2)
# 
# Path: lsh/utils/similarity.py
# def compute_positive_hash(value):
#     return hash(value) % ((sys.maxsize + 1) * 2)
# 
# Path: lsh/models/documents/jaccard_document.py
# class JaccardDocument(DocumentBase):
#     """
#         This class represents documents used in LSH families for Jaccard Distance
#         based implementations and their corresponding components in this platform.
#     """
# 
#     def __init__(self, original_doc, shingles_list=None, minhash_signatures=None):
#         self.__shingles = shingles_list
#         self.__signatures = minhash_signatures
# 
#         super(JaccardDocument, self).__init__(original_doc)
# 
#     def get_signatures_list(self):
#         return self.__signatures
# 
#     def get_shingles_list(self):
#         return self.__shingles
# 
#     def set_signatures_list(self, value):
#         self.__signatures = value
# 
#     def set_shingles_lists(self, value):
#         self.__shingles = value
# 
#     def get_shingles_as_set(self):
#         return set(self.__shingles)


# Path: lsh/lsh/lsh_jaccard.py
from lsh.lsh.lsh_base import LshBase
from lsh.utils.similarity import jaccard_similarity
from lsh.utils.similarity import compute_positive_hash
from lsh.models.documents.jaccard_document import JaccardDocument
import copy



    #--- helper functions ----

    def _build_results_dict(self, score, match_found, doc_1, doc_2, band_matched):
        """
            Build LSH results dictionary.
            :param score:
            :param match_found:
            :param doc_1:
            :param doc_2:
            :return: results dict that contains candidate documents, threshold and LSH similarity score.
        """
        results_dict = {"score": score,
                        "match_found": match_found,
                        "document_1": doc_1,
                        "document_2": doc_2,
                        "threshold": self.threshold,
                        "band_matched": band_matched}
        return results_dict

    #TODO refactor so that users can specify their own hashing function(s)
    def _calculate_hash(self, obj):
        """
            This method computes hash of object using a dynamic hashing function.
            :param obj: object we are computing hash code for.
            :return: hash code (long integer)
        """

        # hash value to positive integer

        h1 = compute_positive_hash(obj)