tlhIngan-Hol Archive: Mon Mar 24 18:57:51 2008
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: Klingon phonology in regular expressions
[email protected] wrote:
> [email protected] writes:
>
>> Has anyone ever worked with matching Klingon words in regular
>> expressions? It's the prefixes (and -oy) that really cause problems.
>> Specifically, I'm trying to build a series of replacements to transform
>> ta' Hol into the Morskan dialect.
>
> Can you explain further what you want, and perhaps give some examples?
The rules for the Morskan dialect, in KGT, can be summarized as follows:
final tlh --> ts
initial tlh --> ghl
initial H --> h
final H --> (silent)
initial Q --> H
To programmatically convert from ta' Hol to Morskan, I need to take a
sentence, match each (Klingon) letter in the left column with a regular
expression, and replace it with the (Klingon) letter in the right column.
DaH HIq QaQ vItlhutlh
becomes
Da hIq HaQ vIghluts
A (PCRE, which is what the MUSH uses) regular expression to match, say,
final H starts to look something like this:
(?<=[b-yB-Y'][^aeIou])H((?![aeIou])|(?=oy))*
I'm not very good at regular expressions, but I THINK this is the
correct way to match "a capital H that has any letter and a vowel before
it, and either no vowel or oy after it zero or more times."
Naturally, my eyes have already gone cross-eyed, and I was wondering if
anyone else had worked out anything like this before. Or come up with a
better way to do it on a MUSH.
As long as you're dealing with CVC words and suffixes, it's easy. But
when you add the CV elements, it gets much harder. And -oy really messes
things up.
(Converting the Qotmagh and taq'ev dialects was child's play.)
--
SuStel
Stardate 8230.3