projects
/
python-collate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
More tweaks; notably try to insert paragraph breaks rather than a separate Python...
[python-collate.git]
/
collate
/
icu
/
__init__.py
diff --git
a/collate/icu/__init__.py
b/collate/icu/__init__.py
index
00a1538
..
5f3ec05
100644
(file)
--- a/
collate/icu/__init__.py
+++ b/
collate/icu/__init__.py
@@
-37,9
+37,11
@@
class Collator(collate._abcollator.Collator):
self._breaker = _icu.WordBreaker("root")
def words(self, string):
self._breaker = _icu.WordBreaker("root")
def words(self, string):
+ """Split the string along word boundries."""
if isinstance(string, str):
if isinstance(string, str):
- string = string.decode(self.encoding, 'replace')
- return filter(lambda u: not u.isspace(), self._breaker.words(string))
+ string = string.decode(self.encoding)
+ words = self._breaker.words(string)
+ return [w for w in words if not w.isspace()]
def key(self, string):
"""Sort key for a string.
def key(self, string):
"""Sort key for a string.
@@
-61,5
+63,5
@@
class Collator(collate._abcollator.Collator):
if isinstance(a, str):
a = a.decode(self.encoding, 'replace')
if isinstance(b, str):
if isinstance(a, str):
a = a.decode(self.encoding, 'replace')
if isinstance(b, str):
- b =
a
.decode(self.encoding, 'replace')
+ b =
b
.decode(self.encoding, 'replace')
return self._collator.cmp(a, b)
return self._collator.cmp(a, b)