Sort-ArbBiLex
view release on metacpan or search on metacpan
Consider the words "resume" and "résumé" (the latter should display on
your POD viewer with acute accents on the e's). If you declare a sort
order such that e-acute ("é") is a letter after e (no accent), then
"résumé" (with accents) would sort after every word starting with "re"
(no accent) -- so "résumé" (with accents) would come after "reward".
If, however, you treated e (no accent) and e-acute as the same letter,
the ordering of "resume" and "résumé" (with accents) would be
unpredictable, since they would count as the same thing -- whereas
"resume" should always come before "résumé" (with accents) in English
dictionaries.
What bi-level lexicographic sorting means is that you can stipulate that
two letters like e (no accent) and e-acute ("é") generally count as the
same letter (so that they both sort before "reward"), but that when
there's a tie based on comparison that way (like the tie between
"resume" and "résumé" (with accents)), the tie is broken by a
stipulation that at a second level, e (no accent) does come before e-
acute ("é").
(Some systems of sort order description allow for any number of levels
in sort orders -- but I can't imagine a case where this gets you
anything over a two-level sort.)
Moreover, the units of sorting for a writing system may not be
characters exactly. In some forms of Spanish, ch, while two characters,
counts as one glyph -- a "letter" after c (at the first level, not just
the second, like the e in the paragraph above). So "cuerno" comes
*before* "chile". A character-based sort would not be able to see that
"ch" should count as anything but "c" and "h". So this library doesn't
assume that the units of comparison are individual characters.
[end POD excerpt]
PREREQUISITES
This suite requires Perl 5; I've only used it under Perl 5.004, so for
anything lower, you're on your own.
Sort::ArbBiLex doesn't use any nonstandard modules.
INSTALLATION
You install Sort::ArbBiLex, as you would install any perl module
library, by running these commands:
perl Makefile.PL
make
make test
make install
If you want to install a private copy of Sort::ArbBiLex in your home
directory, then you should try to produce the initial Makefile with
something like this command:
perl Makefile.PL LIB=~/perl
Then you may need something like
setenv PERLLIB "$HOME/perl"
in your shell initialization file (e.g., ~/.cshrc).
For further information, see perldoc perlmodinstall
DOCUMENTATION
POD-format documentation is included in ArbBiLex.pm. POD is readable
with the 'perldoc' utility. See ChangeLog for recent changes.
MACPERL INSTALLATION NOTES
Don't bother with the makefiles. Just make a Sort directory in your
MacPerl site_lib or lib directory, and move ArbBiLex.pm into there.
SUPPORT
Questions, bug reports, useful code bits, and suggestions for
Sort::ArbBiLex should just be sent to me at sburke@cpan.org
AVAILABILITY
The latest version of Sort::ArbBiLex is available from the
Comprehensive Perl Archive Network (CPAN). Visit
<http://www.perl.com/CPAN/> to find a CPAN site near you.
COPYRIGHT
Copyright 1999-2004, Sean M. Burke <sburke@cpan.org>, all rights
reserved. This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
AUTHOR
Sean M. Burke <sburke@cpan.org>
( run in 0.762 second using v1.01-cache-2.11-cpan-2398b32b56e )