utils.py 文件源码

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

项目:Learning-sentence-representation-with-guidance-of-human-attention 作者: wangshaonan 项目源码 文件源码
def getDataSentiment(batch):
    g1 = []
    g1_pos = []
    for i in batch:
        g1.append(i[0].embeddings)
    g1_pos.append(i[0].pos_embeddings)

    g1x, g1x_pos = prepare_data(g1,g1_pos)

    scores = []
    for i in batch:
        temp = np.zeros(2)
        label = i[1].strip()
        if label == "0":
            temp[0]=1
        if label == "1":
            temp[1]=1
        scores.append(temp)
    scores = np.matrix(scores)+0.000001
    scores = np.asarray(scores,dtype=config.floatX)
    return (scores,g1x,g1x_pos)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号