[84278] in tlhIngan-Hol

home help back first fref pref prev next nref lref last post

Re: Klingon phonology in regular expressions

daemon@ATHENA.MIT.EDU (David Trimboli)
Mon Mar 24 21:58:05 2008

Date: Mon, 24 Mar 2008 21:55:51 -0400
From: David Trimboli <david@trimboli.name>
In-reply-to: <bf3.292109c4.3519abe7@wmconnect.com>
To: tlhingan-hol@kli.org
Errors-to: tlhingan-hol-bounce@kli.org
Reply-to: tlhingan-hol@kli.org

MorphemeAddict@wmconnect.com wrote:
> david@trimboli.name 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



home help back first fref pref prev next nref lref last post