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