pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
[personal profile] pne

I just wrote my first Perl module that uses Module::Build to install itself (the KoolAid I tasted at YAPC::Europe seemed good). Took me a little while to get my head wrapped around it but I finally managed to get it to do what it was supposed to.

The module I wrote was Lingua::Klingon::Collate, soon coming to a CPAN mirror near you. It'll let you sort Klingon words in Klingon alphabetical order (so "ngan" comes after "nob").

While I was at it, I also wrote Lingua::Klingon::Segment, which splits up Klingon words into syllables and letters, so now you know that "monghom" is "mon-ghom" / "m-o-n-gh-o-m" but "mongHom" is "mong-Hom" / "m-o-ng-H-o-m" (that is, the "g" belongs to a different syllable).

Date: Monday, 22 September 2003 14:20 (UTC)
From: [identity profile] n-true.livejournal.com
I don't know anything about that Module and the language its written in, but is there a chance to use it with Microsoft Excel, to sort my list in there?

sorting Klingon in Excel

Date: Tuesday, 23 September 2003 03:07 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com

I think not directly -- I don't think Excel allows you to use alternative sort orders.



Looking through the documentation, I saw that you can add user-defined sort orders but only as a list (so you'd have to make a list with all possible Klingon words in the correct order in order to sort Klingon words -- rather self-defeating), and I also saw this:



Sortierreihenfolgen richten sich nach dem Gebietsschema. Stellen Sie sicher, daß Sie im Dialogfeld Ländereinstellungen in der Windows-Systemsteuerung das richtige Gebietsschema ausgewählt haben. Weitere Informationen zum Ändern des Gebietsschemas finden Sie in Ihrer Windows-Dokumentation.



So maybe you have to change your Windows installations's regional settings to "tlhIngan Hol (Qo'noS)" :p



You could maybe faff around with calling Perl code from VBA through the Windows scripting host, but I don't know how ugly it would be.



The two realistic alternatives that I see are:




  • Using Perl with the Win32::OLE module to "remote-control" Excel - read out the data from Excel using OLE, sort them in Perl space, and replace them in the cells in the correct order.

  • Use Excel to export the dictionary records to a text format such as tab-delimited, then use a Perl script with the Lingua::Klingon::Collate module to sort that TSV file and write out a new one, which you then import into Excel (either into the existing spreadsheet or into a new one).



I'd probably go with the second option because, while it requires more manual work, I don't have as much experience with OLE automation. (Though I have used OLE automation with Perl and Excel before... I could probably see if I could find the script to use it as an example.)



The first is more "elegant" because you don't have to remember to export the list and then import it again; you just call the Perl script and it fiddles with the spreadsheet for you.

Re: sorting Klingon in Excel

Date: Tuesday, 23 September 2003 08:38 (UTC)
From: [identity profile] n-true.livejournal.com
I also thought of that second option, it would include a bit of work, but I don't think it'd be too much. Except for that I have no knowledge of Perl scripts whatsoever.
But I only would have to do this once; I do not need to sort the file in future, I guess, 'cause I will only add or correct single entries and thus can insert them into the correct place right from the start.

Re: sorting Klingon in Excel

Date: Tuesday, 23 September 2003 09:01 (UTC)
ext_78: A picture of a plush animal. It looks a bit like a cross between a duck and a platypus. (Default)
From: [identity profile] pne.livejournal.com
If you want, send me the dictionary as a text file (preferably as a tab-separated file, aka "Text (Tabs getrennt)") and I'll send it back to you sorted. (Perhaps best to use my email address <username>@livejournal.com; that'll reach me regardless of whether I'm at home or at work at the moment.)

That's probably easier than getting you to install Perl and the necessary modules :)

Profile

pne: A picture of a plush toy, halfway between a duck and a platypus, with a green body and a yellow bill and feet. (Default)
Philip Newton

June 2015

S M T W T F S
 12 3456
78910111213
14151617181920
2122232425 2627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Saturday, 24 January 2026 03:04
Powered by Dreamwidth Studios