Lingua::Klingon::Collate

Lingua::Klingon::Collate can sort words in Klingon sort order.
Download

Lingua::Klingon::Collate Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Philip Newton
  • Publisher web site:
  • http://search.cpan.org/~pne/Lingua-Zompist-Cadhinor-0.92/Cadhinor.pm

Lingua::Klingon::Collate Tags


Lingua::Klingon::Collate Description

Lingua::Klingon::Collate can sort words in Klingon sort order. Lingua::Klingon::Collate can sort words in Klingon sort order.SYNOPSIS use Lingua::Klingon::Collate; my @sorted_words; @sorted_words = sort { Lingua::Klingon::Collate::strcoll($a, $b) } @words; # alternatively @sorted_words = sort Lingua::Klingon::Collate::strcoll @words;or use Lingua::Klingon::Collate ':all'; my @sorted_words; @sorted_words = sort { strcoll($a, $b) } @words; # alternatively @sorted_words = sort strcoll @words;or use Lingua::Klingon::Collate qw( strcoll strxfrm strxfrm ); my @sorted_words; # using strcoll @sorted_words = sort strcoll @words; # using strxfrm and a Schwartzian Transform @sorted_words = map { $_-> } sort { $a-> cmp $b-> } map { } @words; # using strxfrm, native sort, and strunxfrm # (need to use unary + in front of strxfrm so that it is not # treated as the sort sub argument to sort) @sorted_words = strunxfrm sort +strxfrm @words;Lingua::Klingon::Collate is a module which allows you to sort words in Klingon sort order (for example, 'ngan' should sort after 'nob' since 'ng' comes after 'n' in Klingon sort order and counts as one letter).You can either transform all words into a representation that allows you to use the normal sort command, or use a subroutine that will transform a word "on the fly".Generally, if you are sorting many words, it will be quicker to transform each word individually and sort the transformed words. You can either keep a record of which original word matches which transformed word (as in the example using the Schwartzian Transform), or untransform the words after sorting (as in the example using strunxfrm).Requirements:· Perl Requirements: · Perl


Lingua::Klingon::Collate Related Software