PDA

View Full Version : Durkonizer (perl)



Castamir
2007-06-29, 07:22 AM
Here's my stab at an English-to-Scottishdwarvish filter, version 0.1.
Would anyone care to comment before it's released for mass consumption?

#!/usr/bin/perl -w

@repl=qw(
^yes$:aye there:thar eir$:ar
about:aboot ^he$:'e them:'em
^him:'im out_of$:outta of_course:'course
^of$:o' ^and$:an' to$:ta
tog:tag that:tha the:tha
wouldn't:wouldn'ta cannot:cannae can't:cannae
don't:dinnae 're$:r for$:fer
ver$:'er ber$:b'r every$:ev'ry
en$:'n ^if$:if'n enl:'nl
eng:'ng ing:in' ment:mn't
^es:'s ^ex:'s ^not$:na
^no$:nay n't_have:n'tve ^is$:be
^are$:be have:haf abl:'bl
^you$:ye ^your:yer ^you':ye'
noth:nuth ^this$:'tis ^here:'ere
doesn't:don't at_a$:atta ith$:it'
ered$:'red into$:inta ^before:'fore
wit'_':wit_' wit'_t:wit_t wit'_w:wit_w
wit'_y:wit_y get_a:git_a ally$:'lly$
^my:me ^i_think$:methinks nay_w:na_w
^one$:'un ^'un_a:one_a at_ta$:atta
ot_ta$:otta ^isn't$:ain't ^so_th:s'th
ned$:n'd
);

sub firstu($)
{
$_[0]=~s/^([^a-z]*)([a-z])/$1\u$2/;
return $_[0];
}

while($txt=<>)
{
for(@repl)
{
s/_/ /g;
($l,$r)=split(/:/,$_);
for([$l,$r], [firstu $l, firstu $r], ["\U$l","\U$r"])
{
($l,$r)=@$_;
$l=~s/^\^/\\b/;
$l=~s/\$$/\\b/;
$txt=~s/$l/$r/g;
}
}
print $txt;
}

Simons Mith
2007-06-29, 08:38 AM
Before:

Well, I suppose the thing to do is to test it:

To be or not to be; that is the question. Whether it is nobler in the mind to suffer the slings and arrows of outrageous fortune, or to take arms against a sea of troubles; and by opposing end them. To die; to sleep; to sleep perchance to dream - yes, there's the rub. For in that sleep of death what dreams may come, when we have shuffled off this mortal coil, may give us pause.


After:

Well, I suppose tha thin' ta do be ta test it:

Ta be or na ta be; tha be tha question. Whethar it be nobler in tha mind ta suffer tha slin's an' arrows o' outrageous fortune, or ta take arms against a sea o' troubles; an' by opposin' end 'em. Ta die; ta sleep; ta sleep perchance ta dream - aye, thar's tha rub. Fer in tha sleep o' death what dreams may come, wh'n we haf shuffled off 'tis mortal coil, may give us pause.

Simons Mith
2007-06-29, 08:47 AM
That's pretty cool, I'd say. Couple of minor refinements:

"tha" probably ought to have an apostrophe on the end
against could be "agin"
"wh'n" for "when" could perhaps be "whan" instead

"na" for "not" might be better as "nae", although I don't think that's Durkon canon. Similarly "nae" for "never", "tae" instead of "ta" for to, and "twa" for "two".

But overall I think you've done a pretty good job of capturing Durkon's accent.

squidthingy
2007-06-29, 09:00 AM
Nice

That's all

Tolkien_Freak
2007-06-29, 09:34 AM
That's cool. I could probably do it manually just as easily (if writing dialogue for Durkon), but it's cool. I like it.

SPoD
2007-06-29, 12:19 PM
I might suggest adding "lass" as a replacement for girl or woman, and "lad" as a replacement for boy or man, along with plurals.

TheNovak
2007-06-29, 12:41 PM
That is exceptionally cool! How do you use it? I'm assuming there's some sort of program involved.

Tolkien_Freak
2007-06-29, 12:42 PM
That is exceptionally cool! How do you use it? I'm assuming there's some sort of program involved.

It's a perl script. Not exactly sure how you use it (never used it myself), but perl is a programming language, so if you have a program that knows how to run it, it will run as a program.

Uzraid
2007-06-29, 01:17 PM
Hmmm. Drawing from my memory of Burns's dialect:

Who/what = wha
here = hair
more = mair
-ing is = in's

Also: awesome!

U

Basalock
2007-06-30, 09:46 PM
you get a cookie :smallsmile:

Tirian
2007-06-30, 11:14 PM
That is exceptionally cool! How do you use it? I'm assuming there's some sort of program involved.

Yup. You'd need a perl interpreter on your computer, which you probably don't have. If you wanted, you could download ActivePerl for just about every operating system from www.activestate.com. Once you've done that, it's just a matter of opening some sort of command prompt and typing something along the lines of "perl durkon.pl to_be.txt" and reading the hilarity that is output.

As far as the key array itself, it seems to me that part of the joke is that "she" is also translated as "'e". Also, you are parsing "this" into "'tis", which seems more appropriate for "this is" or "it is". Still, a most impressive effort.

Capt'n Ironbrow
2007-07-03, 02:27 PM
Is Durkon the only dwarf to speak in the usual Welsh-Scottish-Irish hybrid dwarf accent? or do the other dwarfs speak like that also? Helga for example didn't speak in this way... but she might have been an exception because her "human" take on life (Duty? what about ME?).

When I started roleplaying a dwarf, I used a rural East-Netherlands accent from the start but haven't done it so much lately... I should do so again, it gave me bonus XP for good roleplay :smallwink:

hey... something like that could actually be the reason why Durkon might be the only dwarf to talk that way, most other guys from my group do not use accent when they play a dwarf-PC, or speak as dwarf-npc when DM.