from keras.preprocessing.sequence import pad_sequences max_comment_length = 120 # 设定评论输入长度为120,并填充默认值(如字数少于120) X_train = pad_sequences(X_train_tokenized_lst, maxlen=max_comment_length)