max_sentence_len
= max(len(l
) for l
in corpus_int
)input_seq = np.array(tf.keras.preprocessing.sequence.pad_sequences(corpus_int,padding = 'pre',truncating = 'pre',maxlen = max_sentence_len))
predictors, label = input_seq[:,:-1],input_seq[:,-1]#predictors everything except last, label only last
label = ku.to_categorical(label, num_classes=total_words,dtype='int32')
predictors
array([[ 0, 0, 0, ..., 10, 5, 544],
[ 0, 0, 0, ..., 64, 8, 854],
[ 0, 0, 0, ..., 855, 174, 2],
...,
[ 0, 0, 0, ..., 129, 49, 94],
[ 0, 0, 0, ..., 183, 159, 60],
[ 0, 0, 3, ..., 3, 2157, 4]], dtype=int32)
label
array([[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
...,
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 0],
[0, 0, 0, ..., 0, 0, 1]], dtype=int32)