reuters.py 文件源码

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

项目:deep-learning-keras-projects 作者: jasmeetsb 项目源码 文件源码
def get_word_index(path='reuters_word_index.pkl'):
    """Retrieves the dictionary mapping word indices back to words.

    # Arguments
        path: where to cache the data (relative to `~/.keras/dataset`).

    # Returns
        The word index dictionary.
    """
    path = get_file(path, origin='https://s3.amazonaws.com/text-datasets/reuters_word_index.pkl')
    f = open(path, 'rb')

    if sys.version_info < (3,):
        data = cPickle.load(f)
    else:
        data = cPickle.load(f, encoding='latin1')

    f.close()
    return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号