utils.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:rnn-sentiment-analysis 作者: kashizui 项目源码 文件源码
def glove2dict(src_filename):
    """GloVe Reader.

    Parameters
    ----------
    src_filename : str
        Full path to the GloVe file to be processed.

    Returns
    -------
    dict
        Mapping words to their GloVe vectors.

    """
    reader = csv.reader(open(src_filename), delimiter=' ',
                        quoting=csv.QUOTE_NONE)
    return {line[0]: np.array(list(map(float, line[1:]))) for line in reader}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号