def encode_sequences(tokenizer, length , lines): seq = tokenizer.text_to_sequences(lines) seq = pad_sequences(seq, maxlen = length, padding = 'posts') return seq from sklearn.model_selection import train_test_split train , test = train_test_split(deu_eng , test_size = 0.2, random_state = 12) trainX = encode_sequences(deu_tokenizer, deu_length, train[:,1]) trainY = encode_sequences(eng_tokenizer, eng_length, train[:,0]) testX = encode_sequences(deu_tokenizer, deu_length, test[:,1]) testY = encode_sequences(eng_tokenizer, eng_length, test[:,0])
I believe you have mispelled the texts_to_sequences attribute. The error states that it cannot find the text_to_sequences method in the line:
seq = tokenizer.text_to_sequences(lines)
From the documentation , you can see that this method should be spelled:
seq = tokenizer.texts_to_sequences(lines)
This should resolve the error.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.