Commit 0d205ffa authored by Neal Wu's avatar Neal Wu
Browse files

Update textsum/batch_reader.py to use six.next()

parent 692b7526
......@@ -21,6 +21,7 @@ from threading import Thread
import time
import numpy as np
import six
from six.moves import queue as Queue
from six.moves import xrange
import tensorflow as tf
......@@ -133,7 +134,7 @@ class Batcher(object):
pad_id = self._vocab.WordToId(data.PAD_TOKEN)
input_gen = self._TextGenerator(data.ExampleGen(self._data_path))
while True:
(article, abstract) = input_gen.next()
(article, abstract) = six.next(input_gen)
article_sentences = [sent.strip() for sent in
data.ToSentences(article, include_token=False)]
abstract_sentences = [sent.strip() for sent in
......@@ -242,7 +243,7 @@ class Batcher(object):
def _TextGenerator(self, example_gen):
"""Generates article and abstract text from tf.Example."""
while True:
e = example_gen.next()
e = six.next(example_gen)
try:
article_text = self._GetExFeatureText(e, self._article_key)
abstract_text = self._GetExFeatureText(e, self._abstract_key)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment