initial python implementation of UCA available

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

initial python implementation of UCA available

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.

James
--
James Tauber                       http://jtauber.com/
journeyman of some   http://jtauber.com/blog/


_______________________________________________
I18n-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/i18n-sig
Reply | Threaded
Open this post in threaded view
|

Re: initial python implementation of UCA available

M.-A. Lemburg
James Tauber wrote:

> 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)
>>> 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 ! ::::
_______________________________________________
I18n-sig mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/i18n-sig