Skip to content

What are the MAX_LEN_WORD, VOCAB and VOC_IND? #35

@TaihengLiu

Description

@TaihengLiu

Some problems about python file "data_manager.py "

def label2int(self,label):  # label shape (num,len)
    # seq_len=[]
    target_input = np.ones((MAX_LEN_WORD), dtype=np.float32) + 2  # 初始化为全为PAD
    target_out = np.ones((MAX_LEN_WORD), dtype=np.float32) + 2  # 初始化为全为PAD
    target_input[0] = 0  # 第一个为GO
    for j in range(len(label)):
        target_input[j + 1] = VOCAB[label[j]]
        target_out[j] = VOCAB[label[j]]
        target_out[len(label)] = 1
    return target_input, target_out

def int2label(self,decode_label):
    label = []
    for i in range(decode_label.shape[0]):
        temp = ''
        for j in range(decode_label.shape[1]):
            if VOC_IND[decode_label[i][j]] == '<EOS>':
                break
            elif decode_label[i][j] == 3:
                continue
            else:
                temp += VOC_IND[decode_label[i][j]]
        label.append(temp)
    return label

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions