Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)
From: Cameron Laird (claird_at_lairds.com)
Date: 04/26/04
- Next message: Timo Virkkala: "Re: Python-list, Exotic sex is urgently necessary for you!"
- Previous message: Phil Tomson: "Re: How's ruby compare to it older brother python"
- In reply to: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Next in thread: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Reply: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Apr 2004 17:36:56 -0000
In article <knbjc.267$id.3998@news2.e.nsc.no>,
Leif B. Kristensen <junkmail@solumslekt.org> wrote:
.
.
.
>The routine is for a phonetic search in Norwegian 18th century names,
>which can be spelled in an amazing number of different ways. As I found
>that the Soundex algorithm was useless for Norwegian spellings, I
>invented my own. It's not really an algorithm, but a series of
>substitutions that reduces names to a kind of primitives. Thus, eg.
>Berthe, Birthe, Bergitte, Bergit, Birgit, Børte, Berit, and Brit, which
>actually are interchangeable spellings of the same name, are reduced to
>BRT.
>
>Here's a small sample:
>
>$str =~ s/HN/N/g; # John --> JON
>$str =~ s/TH/T/g; # Thor --> TOR
>$str =~ s/CHI/KJ/g; # Torchild --> TORKJL
>$str =~ s/CHE/KJ/g; # Michel --> MKJL
>$str =~ s/KKE/KJ/g; # Mikkel --> MKJL
>$str =~ s/KIEL/KJL/g; # Kield -> Kjeld ( --> KJL)
>$str =~ s/CH/K/g; # Christen -> Kristen ( --> KRSTN)
>$str =~ s/CA/KA/g; # Carl -> Karl ( --> KAL)
>$str =~ s/RL/L/g; # Thorleif <=> Tollef <=> Tolf ( --> TOLF)
>
>I use a Perl script to transform my genealogy data from a FoxPro
>database to MySQL command scripts. Thanks to the excellent module
>DBD::XBase by Jan Pazdziora, this is a quite simple task.
>
>In theory, the web routine for phonetic searches might have been
>implemented in PHP. The trouble with that is that I would have to
>maintain both a PHP and a Perl version of the same routine. I find it
>much easier to just copy and paste the whole mess (at present about 120
>lines) between the encoding and the decoding routines in Perl, and run
>an exec("perl norphon.pl $name") from PHP.
.
.
.
Long ago, I was myself involved in a tiny way with
parish records for Finnmark and Troms. I wish I'd
been able to do more ...
I'm glad things are working for you. I'm all for
not-duplicating effort. Do you realize you can use
PHP from the command line? As I understand your
explanation, it doesn't reflect AT ALL on a defici-
ency in PHP string-handling; to my eye, PHP can do
the operation just about as well as Perl.
Incidentally, Tcl has a one-liner for this, along
the lines of
set str [string map {HN N TH T CHI KJ CHE KJ ...} $str]
I believe Perl does, too, but haven't enough interest
to track it down now. I'm also confident we can find
a language which makes the particular operation even
more transparent.
I continue to conclude that all these languages are
roughtly equally competent at managing strings.
-- Cameron Laird <claird@phaseit.net> Business: http://www.Phaseit.net
- Next message: Timo Virkkala: "Re: Python-list, Exotic sex is urgently necessary for you!"
- Previous message: Phil Tomson: "Re: How's ruby compare to it older brother python"
- In reply to: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Next in thread: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Reply: Leif B. Kristensen: "Re: Is Perl *that* good? (was: How's ruby compare to it older brother python)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|