import pickle


def read_encoded_ctx_file(encoded_ctx_file: str):
    """
    Returns dictionary containing the encoded passages and their vector embeddings
    :param encoded_ctx_file:
    :return:
    """
    with open(encoded_ctx_file, mode="rb") as f:
        p_emb = pickle.load(f)

    # create dictionary, so that i can lookup embeddings
    p_emb_dict = {}
    for passage in p_emb:
        p_emb_dict.update({passage[0]: passage[1]})
    return p_emb_dict