def process_file(filename, word_to_id, cat_to_id, max_length=600):
    '将文件转换为id表示'
    (contents, labels) = read_file(filename)
    (data_id, label_id) = ([], [])
    for i in range(len(contents)):
        label_id.append(cat_to_id[labels[i]])
    y_pad = kr.utils.to_categorical(label_id, num_classes=len(cat_to_id))
    return (contents, y_pad)
将文件转换为id表示
def process_file(filename, word_to_id, cat_to_id, max_length=600):
    
    (contents, labels) = read_file(filename)
    (data_id, label_id) = ([], [])
    for i in range(len(contents)):
        label_id.append(cat_to_id[labels[i]])
    y_pad = kr.utils.to_categorical(label_id, num_classes=len(cat_to_id))
    return (contents, y_pad)