# 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

def _get_documents(hash_code, band_dict):
    if hash_code and band_dict:
        return band_dict.get(hash_code, None)
    return None

def _update_bucket(hash_code, band_dict, new_document):
    docs = band_dict.get(hash_code, None)
    if docs:
        updated_docs = copy.deepcopy(docs)
        updated_docs.append(new_document)
        band_dict[hash_code] = updated_docs
        # print "updated!!"
        # for doc in updated_docs:
        #     print doc.get_original_document()


# 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


def _get_documents(hash_code, band_dict):
    if hash_code and band_dict:
        return band_dict.get(hash_code, None)
    return None

def _update_bucket(hash_code, band_dict, new_document):
    docs = band_dict.get(hash_code, None)
    if docs:
        updated_docs = copy.deepcopy(docs)
        updated_docs.append(new_document)
        band_dict[hash_code] = updated_docs
        # print "updated!!"
        # for doc in updated_docs:
        #     print doc.get_original_document()


class LshJaccard(LshBase):