import pickle
import bz2


def load_embeddings(saved_embeddings):
    """
    Loads frequencies (dict) and embeddings (dict) from pickled bz2 file
    :param saved_embeddings:  pkl.bz2 file
    :return: word_frequencies, word_embedding_map
    """
    (frequencies, word_embedding_map) = pickle.load(bz2.BZ2File(saved_embeddings, 'r'), encoding='bytes')

    return frequencies, word_embedding_map