Pads each sequence to the same length (length of the longest sequence).
pad_sequences(sequences, maxlen = NULL, dtype = "int32", padding = "pre",
truncating = "pre", value = 0)
List of lists where each element is a sequence
int, maximum length
type to cast the resulting sequence.
'pre' or 'post', pad either before or after each sequence.
'pre' or 'post', remove values from sequences larger than maxlen either in the beginning or in the end of the sequence
float, value to pad the sequences to the desired value.
Array with dimensions (number_of_sequences, maxlen)
If maxlen is provided, any sequence longer than maxlen is truncated to maxlen. Truncation happens off either the beginning (default) or the end of the sequence. Supports post-padding and pre-padding (default).
Other text preprocessing: make_sampling_table
,
skipgrams
,
text_hashing_trick
,
text_one_hot
,
text_to_word_sequence