1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
#!/usr/bin/perl -p
# an array, not a hash. because order is important
@trans_table=(
'\bmy\b' => 'me',
'\bboss\b' => 'admiral',
'\bmanager\b' => 'admiral',
'\b[Cc]aptain\b' => "Cap'n",
'\bmyself\b' => 'meself',
'\byour\b' => 'yer',
'\byou\b' => 'ye',
'\bfriend\b' => 'matey',
'\bfriends\b' => 'maties',
'\bco[-]?worker\b' => 'shipmate',
'\bco[-]?workers\b' => 'shipmates',
'\bearlier\b' => 'afore',
'\bold\b' => 'auld',
'\bthe\b' => "th'",
'\bof\b' => "o'",
'\bdon\'t\b' => "dern't",
'\bdo not\b' => "dern't",
'\bnever\b' => "no nay ne'er",
'\bever\b' => "e'er",
'\bover\b' => "o'er",
'\bYes\b' => 'Aye',
'\bNo\b' => 'Nay',
'\bdon\'t know\b' => "dinna",
'\bhadn\'t\b' => "ha'nae",
'\bdidn\'t\b' => "di'nae",
'\bwasn\'t\b' => "weren't",
'\bhaven\'t\b' => "ha'nae",
'\bfor\b' => 'fer',
'\bbetween\b' => 'betwixt',
'\baround\b' => "aroun'",
'\bto\b' => "t'",
'\bit\'s\b' => "'tis",
'\bIt\'s\b' => 'It be',
'\bwoman\b' => 'wench',
'\blady\b' => 'wench',
'\bwife\b' => 'lady',
'\bgirl\b' => 'lass',
'\bgirls\b' => 'lassies',
'\bguy\b' => 'lubber',
'\bman\b' => 'lubber',
'\bfellow\b' => 'lubber',
'\bdude\b' => 'lubber',
'\bboy\b' => 'lad',
'\bboys\b' => 'laddies',
'\bchildren\b' => 'minnows',
'\bkids\b' => 'minnows',
'\bhim\b' => 'that scurvey dog',
'\bher\b' => 'that comely wench',
'\bhim\.\b' => 'that drunken sailor',
'\bHe\b' => 'The ornery cuss',
'\bShe\b' => 'The winsome lass',
'\bhe\'s\b' => 'he be',
'\bshe\'s\b' => 'she be',
'\bwas\b' => "were bein'",
'\bHey\b' => 'Avast',
'\bher\.\b' => 'that lovely lass',
'\bfood\b' => 'chow',
'\broad\b' => 'sea',
'\broads\b' => 'seas',
'\bstreet\b' => 'river',
'\bstreets\b' => 'rivers',
'\bhighway\b' => 'ocean',
'\bhighways\b' => 'oceans',
'\bcar\b' => 'boat',
'\bcars\b' => 'boats',
'\btruck\b' => 'schooner',
'\btrucks\b' => 'schooners',
'\bSUV\b' => 'ship',
'\bmachine\b' => 'contraption',
'\bairplane\b' => 'flying machine',
'\bjet\b' => 'flying machine',
'\bdriving\b' => 'sailing',
'\bdrive\b' => 'sail',
'\bwith\b' => "wi'",
'\bam\b' => 'be',
'\bis\b' => 'be',
'\bare\b' => 'be',
'\bwas\b' => 'be',
'\bwere\b' => 'be',
'\bwere\b' => 'be',
);
while (@trans_table) {
$key=shift @trans_table;
$value=shift @trans_table;
s/$key/$value/g;
}
s/ing\b/in'/g;
s/ings\b/in's/g;
s/(\.( |\t|$))/avast($1,3)/eg;
s/([!\?]( \t|$))/avast($1,2)/eg; # Greater chance after exclamation
s/\Br\B/roll()/eg;
sub roll {
return 'r' x (rand(5)+1) if rand > 0.5;
return 'r';
}
sub avast {
my $stub=shift;
my $chance=shift;
my @shouts=(
", avast$stub",
"$stub Ahoy!",
", and a bottle of rum!",
", by Blackbeard's sword$stub",
", by Davy Jones' locker$stub",
"$stub Walk the plank!",
"$stub Aarrr!",
"$stub Yaaarrrrr!",
", pass the grog!",
", and dinna spare the whip!",
", with a chest full of booty$stub",
", and a bucket o' chum$stub",
", we'll keel-haul ye!",
"$stub Shiver me timbers!",
"$stub And hoist the mainsail!",
"$stub And swab the deck!",
", ye scurvey dog$stub",
"$stub Fire the cannons!",
", to be sure$stub",
", I'll warrant ye$stub",
"$stub Arr, me hearty!",
);
if (int rand($chance) == 1) {
return @shouts[rand @shouts]." ";
}
else {
return $stub;
}
}
|