projects
/
python-collate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Word-splitting.
[python-collate.git]
/
collate
/
syslocale.py
diff --git
a/collate/syslocale.py
b/collate/syslocale.py
index
1ee2924
..
e2aeed9
100644
(file)
--- a/
collate/syslocale.py
+++ b/
collate/syslocale.py
@@
-12,11
+12,10
@@
locale of all previous collators and anything else using the system
locale information.
Use this collation backend if...
locale information.
Use this collation backend if...
- - You are on a system without ICU or UCA datafiles for the locale,
- and DUCET results are not acceptable.
+ - You are on a system without ICU.
Avoid this backend if...
Avoid this backend if...
- - ICU
or UCA support
is available for the current locale.
+ - ICU is available for the current locale.
- You are sorting strings from alphabets outside the primary locale.
- You need to support collating multiple locales at once.
- You need the same results across multiple platforms.
- You are sorting strings from alphabets outside the primary locale.
- You need to support collating multiple locales at once.
- You need the same results across multiple platforms.
@@
-24,6
+23,7
@@
Avoid this backend if...
"""
import locale
"""
import locale
+import re
import collate.errors
import collate._abcollator
import collate.errors
import collate._abcollator
@@
-66,3
+66,10
@@
class Collator(collate._abcollator.Collator):
b = b.decode(self.encoding, "replace")
return locale.strcoll(a, b)
b = b.decode(self.encoding, "replace")
return locale.strcoll(a, b)
+ def words(self, string, sep=re.compile(r"\W+", re.UNICODE)):
+ """Split the string into separate words.
+
+ This split is done using the locale's notion of a word boundry.
+ """
+ return re.split(sep, string)
+