Fix invalid tokenizer issued by #13, bump version to 2.1.1
This commit is contained in:
parent
5e77f76ead
commit
d991f5e3e3
@ -1,6 +1,6 @@
|
|||||||
"""Free Google Translate API for Python. Translates totally free of charge."""
|
"""Free Google Translate API for Python. Translates totally free of charge."""
|
||||||
__all__ = 'Translator',
|
__all__ = 'Translator',
|
||||||
__version_info__ = 2, 1, 0
|
__version_info__ = 2, 1, 1
|
||||||
__version__ = '.'.join(str(v) for v in __version_info__)
|
__version__ = '.'.join(str(v) for v in __version_info__)
|
||||||
|
|
||||||
|
|
||||||
|
@ -150,6 +150,7 @@ class TokenAcquirer(object):
|
|||||||
# append calculated value if l is less than 2048
|
# append calculated value if l is less than 2048
|
||||||
elif l < 2048:
|
elif l < 2048:
|
||||||
e.append(l >> 6 | 192)
|
e.append(l >> 6 | 192)
|
||||||
|
e.append(l)
|
||||||
# append calculated value if l matches special condition
|
# append calculated value if l matches special condition
|
||||||
elif (l & 64512) == 55296 and g + 1 < size and \
|
elif (l & 64512) == 55296 and g + 1 < size and \
|
||||||
ord(text[g + 1]) & 64512 == 56320:
|
ord(text[g + 1]) & 64512 == 56320:
|
||||||
|
@ -27,6 +27,13 @@ def test_unicode(translator):
|
|||||||
assert result.text == u'こんにちは。'
|
assert result.text == u'こんにちは。'
|
||||||
|
|
||||||
|
|
||||||
|
def test_special_chars(translator):
|
||||||
|
text = u"Copyright © Google"
|
||||||
|
|
||||||
|
result = translator.translate(text, src='en', dest='fr')
|
||||||
|
assert result.text == text
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_sentences(translator):
|
def test_multiple_sentences(translator):
|
||||||
text = u"""Architecturally, the school has a Catholic character.
|
text = u"""Architecturally, the school has a Catholic character.
|
||||||
Atop the Main Building's gold dome is a golden statue of the Virgin Mary.
|
Atop the Main Building's gold dome is a golden statue of the Virgin Mary.
|
||||||
|
Loading…
Reference in New Issue
Block a user