X-Git-Url: https://git.korewanetadesu.com/?p=python-collate.git;a=blobdiff_plain;f=collate%2F_abcollator.py;h=a6ec268d9bb6512bffd6b1d752088798fde6ea09;hp=094a5debbbd7e155d09efe8fca6db85b3435e3b3;hb=96cd5d3ad9dd1390c7739a6c3b9fa03ac3a2b4ff;hpb=29f1f7e12a4ca6100b00dc0d32e84f82f530bcb4 diff --git a/collate/_abcollator.py b/collate/_abcollator.py index 094a5de..a6ec268 100644 --- a/collate/_abcollator.py +++ b/collate/_abcollator.py @@ -1,5 +1,14 @@ class Collator(object): def cmp(self, string1, string2): + """Return negative if a < b, zero if a == b, positive if a > b.""" return cmp(self.key(string1), self.key(string2)) - + def words(self, string): + """Split the string into separate words. + + This split is done using Unicode's definition of whitespace. + """ + return string.split() + + def wordkeys(self, string): + return map(self.key, self.words)