-
Notifications
You must be signed in to change notification settings - Fork 261
Open
Description
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
InDayDay and haohao333
Metadata
Metadata
Assignees
Labels
No labels