More tweaks; notably try to insert paragraph breaks rather than a separate Python...
[python-collate.git] / collate / icu / __init__.py
index 892b8a1..5f3ec05 100644 (file)
@@ -36,6 +36,13 @@ class Collator(collate._abcollator.Collator):
             # so this is a harmless error.
             self._breaker = _icu.WordBreaker("root")
 
+    def words(self, string):
+        """Split the string along word boundries."""
+        if isinstance(string, str):
+            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.