Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 1583032

Browse files
committed
fix tests for Python2
1 parent b912213 commit 1583032

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tensor2tensor/utils/bleu_hook.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# pylint: disable=redefined-builtin
3131
from six.moves import xrange
3232
from six.moves import zip
33+
import six
3334
# pylint: enable=redefined-builtin
3435

3536
import tensorflow as tf
@@ -146,8 +147,8 @@ class UnicodeRegex:
146147
147148
without dependening on https://pypi.python.org/pypi/regex/."""
148149
def _property_chars(prefix):
149-
return ''.join(chr(x) for x in range(sys.maxunicode)
150-
if unicodedata.category(chr(x)).startswith(prefix))
150+
return ''.join(six.unichr(x) for x in range(sys.maxunicode)
151+
if unicodedata.category(six.unichr(x)).startswith(prefix))
151152
punctuation = _property_chars('P')
152153
nondigit_punct_re = re.compile(r'([^\d])([' + punctuation + r'])')
153154
punct_nondigit_re = re.compile(r'([' + punctuation + r'])([^\d])')

0 commit comments

Comments
 (0)