This is a text generation bi-directional LSTM model trained on a corpus of Eurovision song lyrics translated into English, preprocessed to 8,274 tokens (+OOV) and 172,249 n-gram sequences. Each embedding sequence input is a maximum of 202 tokens (pre-padded).
The model was built with Tensorflow 2.12.0.
1seed_text = "Once when I was a child"
2next_words = 10
3
4for _ in range(next_words):
5 sequence = tokenizer.texts_to_sequences([seed_text])[0]
6 sequence = pad_sequences([sequence], maxlen=201, padding='pre')
7 prediction = model.predict(sequence, verbose=0)
8
9 prediction = np.argmax(prediction, axis=-1).item()
10 output = tokenizer.index_word[prediction]
11 seed_text += " " + output
12
13print(seed_text)