# -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Brief: 
import os
import pickle


def load_pkl(pkl_path):
    """
    加载词典文件
    :param pkl_path:
    :return:
    """
    with open(pkl_path, 'rb') as f:
        result = pickle.load(f)
    return result


def dump_pkl(vocab, pkl_path, overwrite=True):
    """
    存储文件
    :param pkl_path:
    :param overwrite:
    :return:
    """
    if os.path.exists(pkl_path) and not overwrite:
        return
    with open(pkl_path, 'wb') as f:
        # pickle.dump(vocab, f, protocol=pickle.HIGHEST_PROTOCOL)
        pickle.dump(vocab, f, protocol=0)

# -*- coding: utf-8 -*-
# Author: XuMing <<EMAIL>>
# Brief: 
import os
import pickle


def load_pkl(pkl_path):
    """
    加载词典文件
    :param pkl_path:
    :return:
    """
    with open(pkl_path, 'rb') as f:
        result = pickle.load(f)
    return result


def dump_pkl(vocab, pkl_path, overwrite=True):
    """
    存储文件
    :param pkl_path:
    :param overwrite:
    :return:
    """
    if os.path.exists(pkl_path) and not overwrite:
        return
    with open(pkl_path, 'wb') as f:
        # pickle.dump(vocab, f, protocol=pickle.HIGHEST_PROTOCOL)
        pickle.dump(vocab, f, protocol=0)

# -*- coding: utf-8 -*- # Author: XuMing <<EMAIL>> # Brief: 加载词典文件     :param pkl_path:     :return: 存储文件     :param pkl_path:     :param overwrite:     :return: # pickle.dump(vocab, f, protocol=pickle.HIGHEST_PROTOCOL)