def proximitySearch(query, stop_list, dict_book, k):
    pipe = Preprocessing()
    pipe.stop_word = stop_list
    tokens = pipe.tokenizer(query)
    stems = pipe.stemmer(tokens)
    w1 = stems[0]
    w2 = stems[1]
    if (dict_book.__contains__(w1) and dict_book.__contains__(w2)):
        posting1: dict = dict_book.get(w1)
        posting2: dict = dict_book.get(w2)
    else:
        return []
    doc_list = []
    for docI in posting1.keys():
        for docJ in posting2.keys():
            if (docI == docJ):
                poslist1: list = posting1.get(docI)
                poslist2: list = posting2.get(docJ)
                match: bool = False
                for pos1 in poslist1:
                    for pos2 in poslist2:
                        if ((pos2 - pos1) == (k + 1)):
                            doc_list.append(docI)
                            match = True
                            break
                    if (match is True):
                        break
    return doc_list
def proximitySearch(query, stop_list, dict_book, k):
    pipe = Preprocessing()
    pipe.stop_word = stop_list
    tokens = pipe.tokenizer(query)
    stems = pipe.stemmer(tokens)
    w1 = stems[0]
    w2 = stems[1]
    if (dict_book.__contains__(w1) and dict_book.__contains__(w2)):
        posting1: dict = dict_book.get(w1)
        posting2: dict = dict_book.get(w2)
    else:
        return []
    doc_list = []
    for docI in posting1.keys():
        for docJ in posting2.keys():
            if (docI == docJ):
                poslist1: list = posting1.get(docI)
                poslist2: list = posting2.get(docJ)
                match: bool = False
                for pos1 in poslist1:
                    for pos2 in poslist2:
                        if ((pos2 - pos1) == (k + 1)):
                            doc_list.append(docI)
                            match = True
                            break
                    if (match is True):
                        break
    return doc_list