Discussion:
[I18n-sig] initial python implementation of UCA available
James Tauber
2006-01-27 06:46:53 UTC
Permalink
See http://jtauber.com/blog/2006/01/27/
python_unicode_collation_algorithm

The core of the UCA is implemented and that's enough to do what I
currently need to do (sort Ancient Greek).

There's actually more code parsing the collation element table than
performing the actual sort key generation :-)

Let me know if you have any comments, suggestions, etc.

James
--
James Tauber http://jtauber.com/
journeyman of some http://jtauber.com/blog/
M.-A. Lemburg
2006-01-27 14:48:10 UTC
Permalink
Post by James Tauber
See http://jtauber.com/blog/2006/01/27/
python_unicode_collation_algorithm
The core of the UCA is implemented and that's enough to do what I
currently need to do (sort Ancient Greek).
There's actually more code parsing the collation element table than
performing the actual sort key generation :-)
Let me know if you have any comments, suggestions, etc.
for part in key:
curr_node = curr_node[1].setdefault(part, [None, {}])

This could be made faster by not using .setdefault():
Python will still build the [None, {}] even if it's
not used.

In general, it's probably better to marshal the trie and
simply load the marshalled form on startup. That saves
you the setup time of having to build a trie from
a few thousand keys.
--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source (#1, Jan 27 2006)
Post by James Tauber
Python/Zope Consulting and Support ... http://www.egenix.com/
mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
________________________________________________________________________

::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
Loading...