fnp
/
librarian.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
move stats to L2
[librarian.git]
/
src
/
librarian
/
hyphenator.py
diff --git
a/src/librarian/hyphenator.py
b/src/librarian/hyphenator.py
index
aa5b4c3
..
c2fbb81
100644
(file)
--- a/
src/librarian/hyphenator.py
+++ b/
src/librarian/hyphenator.py
@@
-14,8
+14,6
@@
info@wilbertberendsen.nl
License: LGPL.
"""
License: LGPL.
"""
-from __future__ import print_function, unicode_literals
-
import sys
import re
import sys
import re
@@
-81,13
+79,13
@@
class Hyph_dict(object):
"""
def __init__(self, filename):
self.patterns = {}
"""
def __init__(self, filename):
self.patterns = {}
- f = open(filename)
+ f = open(filename
, 'rb'
)
charset = f.readline().strip()
charset = f.readline().strip()
- if charset.startswith('charset '):
+ if charset.startswith(
b
'charset '):
charset = charset[8:].strip()
for pat in f:
charset = charset[8:].strip()
for pat in f:
- pat = pat.decode(charset).strip()
+ pat = pat.decode(charset
.decode('latin1')
).strip()
if not pat or pat[0] == '%': continue
# replace ^^hh with the real character
pat = parse_hex(hexrepl, pat)
if not pat or pat[0] == '%': continue
# replace ^^hh with the real character
pat = parse_hex(hexrepl, pat)
@@
-211,7
+209,7
@@
class Hyphenator(object):
the string 'let-ter-gre-pen'. The hyphen string to use can be
given as the second parameter, that defaults to '-'.
"""
the string 'let-ter-gre-pen'. The hyphen string to use can be
given as the second parameter, that defaults to '-'.
"""
- if isinstance(word,
str
):
+ if isinstance(word,
bytes
):
word = word.decode('latin1')
l = list(word)
for p in reversed(self.positions(word)):
word = word.decode('latin1')
l = list(word)
for p in reversed(self.positions(word)):