I have a text file containing one sentence per line
When I create a TextLineDataset and iterate on it with an iterator it returns the file line by line
I want to iterate through my file two tokens at a time, here's my current code:
sentences = tf.data.TextLineDataset("data/train.src")
iterator = sentences.make_initializable_iterator()
next_element = iterator.get_next()
sess = tf.Session()
sess.run(tf.tables_initializer())
sess.run(iterator.initializer)
elem = sess.run(next_element)
print(elem)
Is it possible to do so using a TextLineDataset ?
EDIT : By "tokens" I mean "words"