Skip to content

Commit 66eb101

Browse files
committed
Make textsum compatible with Python 3
1 parent 40a5739 commit 66eb101

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

textsum/batch_reader.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
"""Batch reader to seq2seq attention model, with bucketing support."""
1717

1818
from collections import namedtuple
19-
import Queue
2019
from random import shuffle
2120
from threading import Thread
2221
import time
2322

2423
import numpy as np
24+
from six.moves.queue import Queue
25+
from six.moves import xrange
2526
import tensorflow as tf
2627

2728
import data

textsum/beam_search.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@
2121
decoded.
2222
"""
2323

24+
from six.moves import xrange
2425
import tensorflow as tf
2526

2627
FLAGS = tf.flags.FLAGS
27-
tf.flags.DEFINE_bool('normalize_by_length', True, 'Whether normalize')
28+
tf.flags.DEFINE_bool('normalize_by_length', True, 'Whether to normalize')
2829

2930

3031
class Hypothesis(object):

textsum/seq2seq_attention_decode.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@
1818
import os
1919
import time
2020

21-
import tensorflow as tf
2221
import beam_search
2322
import data
23+
from six.moves import xrange
24+
import tensorflow as tf
2425

2526
FLAGS = tf.app.flags.FLAGS
2627
tf.app.flags.DEFINE_integer('max_decode_steps', 1000000,

textsum/seq2seq_attention_model.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
from collections import namedtuple
1919

2020
import numpy as np
21-
import tensorflow as tf
2221
import seq2seq_lib
23-
22+
from six.moves import xrange
23+
import tensorflow as tf
2424

2525
HParams = namedtuple('HParams',
2626
'mode, min_lr, lr, batch_size, '

0 commit comments

Comments
 (0)