data_input_helper.py 文件源码

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

项目:sentiment_analysis_textcnn 作者: norybaby 项目源码 文件源码
def __init__(self,file_path):
        # w2v_file = os.path.join(base_path, "vectors_poem.bin")
        self.model = word2vec.load(file_path)
        if 'unknown' not  in self.model.vocab_hash:
            unknown_vec = np.random.uniform(-0.1,0.1,size=128)
            self.model.vocab_hash['unknown'] = len(self.model.vocab)
            self.model.vectors = np.row_stack((self.model.vectors,unknown_vec))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号