home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1277 < prev    next >
Internet Message Format  |  1990-12-28  |  9KB

  1. From: smulrine@cs.strath.ac.uk (Stephen K Mulrine)
  2. Newsgroups: alt.sources,soc.culture.british
  3. Subject: A translator
  4. Message-ID: <3600@baird.cs.strath.ac.uk>
  5. Date: 7 May 90 15:11:03 GMT
  6.  
  7. They thought it would never be posted...
  8. It's my Chirpy Cockney translator which turns plaintext into something
  9. completely different. It was "coming soon" in December 1989 but today I
  10. dragged it out of mothballs and tidied it up for posting.
  11.  
  12. Enjoy.
  13.  
  14. #    This is a shell archive.
  15. #    Remove everything above and including the cut line.
  16. #    Then run the rest of the file through sh.
  17. #-----cut here-----cut here-----cut here-----cut here-----
  18. #!/bin/sh
  19. # shar:    Shell Archiver
  20. #    Run the following text with /bin/sh to create:
  21. #    README
  22. #    Makefile
  23. #    ken.l
  24. # This archive created: Mon May  7 12:54:04 1990
  25. # By:    Stephen K Mulrine (Strathclyde University CS Dept)
  26. echo shar: extracting README '(544 characters)'
  27. sed 's/^:)//' << \FOO > README
  28. :)This programs should work on any flavour of UNIX which has 'lex'.
  29. :)
  30. :)ken:
  31. :)will turn English into Cockney, featuring (dubious) rhyming slang for a lot
  32. :)of computer terminology.
  33. :)
  34. :)To create it in the current directory, type 
  35. :)
  36. :)make ken
  37. :)
  38. :)Use
  39. :)  cat [file_of_text] | ken | more
  40. :)or
  41. :)  man [command] | ken | more
  42. :)for endless hours of fun.
  43. :)
  44. :)Written by Stephen K Mulrine <smulrine%cs.strath.ac.uk@nsfnet-relay.ac.uk>
  45. :)Make copies if you want etc.etc.
  46. :)
  47. :)ken is named after Ken the Chirpy Cockney Character from the Viz Comic (tm),
  48. :)who speaks somewhat like that.
  49. FOO
  50. echo shar: extracting Makefile '(211 characters)'
  51. sed 's/^:)//' << \FOO > Makefile
  52. :)#Makefile for ken
  53. :)
  54. :)#Put in your favourite lex or C compiler here
  55. :)LEX = lex
  56. :)CC = cc
  57. :)
  58. :)CLIBS = -ll
  59. :)CFLAGS = -O -s
  60. :)RM = /bin/rm
  61. :)
  62. :)ken:    ken.l
  63. :)    $(LEX) ken.l
  64. :)    $(CC) $(CFLAGS) -o ken lex.yy.c $(CLIBS)
  65. :)    $(RM) -f lex.yy.c
  66. FOO
  67. echo shar: extracting ken.l '(6975 characters)'
  68. sed 's/^:)//' << \FOO > ken.l
  69. :)%e 3000
  70. :)%p 6000
  71. :)%n 1000
  72. :)%k 500
  73. :)%a 4000
  74. :)%o 2000
  75. :)BW [     ]
  76. :)EW [     .,;!?]
  77. :)%{
  78. :)    char buf[128];
  79. :)%}
  80. :)
  81. :)%%
  82. :)
  83. :)stairs        printf("apples and pears");
  84. :)Downstairs    printf("Down the apples and pears");
  85. :)downstairs    printf("down the apples and pears");
  86. :)Upstairs    printf("Up the apples and pears");
  87. :)upstairs    printf("up the apples and pears");
  88. :)[Mm]outh    printf("North and South");
  89. :)[Ff]ace        printf("Boat Race");
  90. :)[Tt]rouble    printf("Barney Rubble");
  91. :)wife        {    switch(rand()%2)
  92. :)            {
  93. :)            case 0: printf("trouble and strife"); break;
  94. :)            case 1: printf("ole lady"); break;
  95. :)            }
  96. :)        }
  97. :)Road        printf("Frog and Toad");
  98. :)" road"        printf(" frog and toad");
  99. :)"pub "        printf("rub-a-dub ");
  100. :)" bar "        printf(" boozer ");
  101. :)" husband"    printf(" ole man");
  102. :)Party        printf("Knees-up");
  103. :)party        printf("knees-up");
  104. :)Parties        printf("Knees-ups");
  105. :)parties        printf("knees-ups");
  106. :)My        printf("Me");
  107. :)" my"        printf(" me");
  108. :)Your        printf("Yer");
  109. :)your        printf("yer");
  110. :)"You are "      printf("Yer ");
  111. :)"you are "      printf("yer ");
  112. :)You        printf("Yer");
  113. :)you        printf("yer");
  114. :)Those        printf("Them");
  115. :)those        printf("them");
  116. :)" those"    printf(" them");
  117. :)"(those"    printf("(them");
  118. :)"The "        {   switch(rand()%5)
  119. :)            {
  120. :)            case 0: printf("The bleedin' "); break;
  121. :)            default: ECHO; break;
  122. :)            }
  123. :)        }
  124. :)"The"        ECHO;
  125. :)" the "        {   switch(rand()%5)
  126. :)            {
  127. :)            case 0: printf(" the bleedin' "); break;
  128. :)            default: ECHO; break;
  129. :)            }
  130. :)        }
  131. :)[" "(]the    ECHO;
  132. :)"the "        {   switch(rand()%5)
  133. :)            {
  134. :)            case 0: printf(" the bleedin' "); break;
  135. :)            default: ECHO; break;
  136. :)            }
  137. :)        }
  138. :)[Tt]his        ECHO;
  139. :)[" "(]this    ECHO;
  140. :)[Tt]hat        ECHO;
  141. :)[" "(]that    ECHO;
  142. :)Thus        printf("So");
  143. :)" thus"        printf(" so");
  144. :)"(thus"        printf("(so");
  145. :)"thus"        printf("so");
  146. :)[Tt]han        ECHO;
  147. :)[" "(]than    ECHO;
  148. :)Who        ECHO;
  149. :)who        ECHO;
  150. :)" old "        printf(" ole ");
  151. :)" to "        printf(" ter ");
  152. :)"Aren't you "   printf("Aintcha ");
  153. :)"aren't you "   printf("aintcha ");
  154. :)"Aren't"    printf("Ain't");
  155. :)"aren't"    printf("ain't");
  156. :)"Isn't"        printf("Ain't");
  157. :)"isn't"        printf("ain't");
  158. :)"Are not "    printf("Ain't");
  159. :)"are not "    printf("ain't ");
  160. :)"Is not "    printf("Ain't ");
  161. :)" is not "    printf(" ain't ");
  162. :)"What is th"    printf("Woss");
  163. :)"what is th"    printf("woss");
  164. :)"What are you "    printf("Wotcher ");
  165. :)"what are you "    printf("wotcher ");
  166. :)"What you are"    printf("Wotcher");
  167. :)"what you are"    printf("wotcher");
  168. :)"What you're"    printf("Wotcher");
  169. :)"what you're"    printf("wotcher");
  170. :)"What are your"    printf("Wotcher");
  171. :)"what are your"    printf("wotcher");
  172. :)"What do you "  printf("Wotcher ");
  173. :)"what do you "    printf("wotcher ");
  174. :)"What do your"  printf("Wotcher");
  175. :)"what do your"    printf("wotcher");
  176. :)" "H[aeu]llo    printf(" Wotcher");
  177. :)" "h[aeu]llo    printf(" wotcher");
  178. :)What        printf("Wot");
  179. :)what        printf("wot");
  180. :)Were        printf("Was");
  181. :)were         printf("was");
  182. :)Bother        printf("Ars");
  183. :)bother        printf("ars");
  184. :)Mother        printf("Muvver");
  185. :)Other        printf("Uvver");
  186. :)other        printf("uvver");
  187. :)Father        printf("Favver");
  188. :)father        printf("favver");
  189. :)Rather        printf("Ravver");
  190. :)rather        printf("ravver");
  191. :)Weather        printf("Wevver");
  192. :)weather        printf("wevver");
  193. :)Leather        printf("Levver");
  194. :)leather        printf("levver");
  195. :)Wither        printf("Wivver");
  196. :)wither        printf("wivver");
  197. :)Either        printf("Eever");
  198. :)either        printf("eever");
  199. :)With        printf("Wiv");
  200. :)with        printf("wiv");
  201. :)Anything    printf("Anyfink");
  202. :)anything    printf("anyfink");
  203. :)Something    printf("Sumfink");
  204. :)something    printf("sumfink");
  205. :)Nothing        printf("Nuffink");
  206. :)nothing        printf("nuffink");
  207. :)guitars        printf("spoons");
  208. :)guitar        printf("spoons");
  209. :)drums        printf("spoons");
  210. :)drum        printf("spoons");
  211. :)trumpets    printf("spoons");
  212. :)trumpet        printf("spoons");
  213. :)violins        printf("spoons");
  214. :)violin        printf("spoons");
  215. :)clarinets    printf("spoons");
  216. :)clarinet    printf("spoons");
  217. :)trombones    printf("spoons");
  218. :)trombone    printf("spoons");
  219. :)oboes        printf("spoons");
  220. :)oboe        printf("spoons");
  221. :)flutes        printf("spoons");
  222. :)flute        printf("spoons");
  223. :)tubas        printf("spoons");
  224. :)tuba        printf("spoons");
  225. :)Data        printf("Info");
  226. :)data        printf("info");
  227. :)Directory    printf("Lockup");
  228. :)directory    printf("lockup");
  229. :)Directories    printf("Lockups");
  230. :)directories    printf("lockups");
  231. :)[Pp]rocess    {   switch(rand()%2)
  232. :)            {
  233. :)            case 0: printf("Queen Bess"); break;
  234. :)            case 1: printf("Rudolf 'Ess"); break;
  235. :)            }
  236. :)        }
  237. :)[Cc]omputer    printf("French Tutor");
  238. :)[Bb]yte        printf("Jimmy White");
  239. :)[Ff]iles    printf("Nobby Stiles");
  240. :)[Ff]ile        printf("Royal Mile");
  241. :)[Ll]anguage    printf("'Am Sandwich");
  242. :)[Zz]ero        printf("Emperor Nero");
  243. :)[Jj]ob        printf("Uncle Bob");
  244. :)[Ss]hell    printf("Bow Bell");
  245. :)[Ss]ave        printf("Chas'n'Dave");
  246. :)[Ll]oad        printf("Old Kent Road");
  247. :)[Mm]ouse    printf("Doll's 'Ouse");
  248. :)[Bb]uffer    printf("Sausage Stuffer");
  249. :)[Kk]eyboard    printf("Henry Ford");
  250. :)[Mm]anual    printf("Cocker Spaniel");
  251. :)[Ss]creen    printf("James Dean");
  252. :)[Pp]rinter    printf("'Arold Pinter");
  253. :)[Pp]lotter    printf("Pansy Potter");
  254. :)[Cc]ompiler    printf("Martin Tyler");
  255. :)[Ss]tring    printf("Emperor Ming");
  256. :)[Bb]rain    printf("Michael Caine");
  257. :)[Pp][Aa][Ss][Cc][Aa][Ll]    {   switch(rand()%2)
  258. :)                    {
  259. :)                    case 0: printf("Pall Mall"); break;
  260. :)                    case 1: printf("Roald Dahl"); break;
  261. :)                    }
  262. :)                }
  263. :)[Aa][Ll][Gg][Oo][Ll]    printf("Johnny Ball");
  264. :)[Ff][Oo][Rr][Tt][Rr][Aa][Nn]    printf("Manfred Mann");
  265. :)[Cc][Oo][Bb][Oo][Ll]    printf("Albert Hall");
  266. :)Stopped        printf("'Ad the mockers put on");
  267. :)stopped        printf("'ad the mockers put on");
  268. :)Stopping    printf("Putting the mockers on");
  269. :)stopping    printf("putting the mockers on");
  270. :)stops        printf("puts the mockers on");
  271. :)stop        printf("put the mockers on");
  272. :)STOP        printf("Put The Mockers On");
  273. :)[Ll]ondoner    printf("Cockney");
  274. :)friend        {   switch(rand()%3)
  275. :)            {
  276. :)            case 0: printf("mucker"); break;
  277. :)            case 1: printf("mate"); break;
  278. :)            case 2: printf("china"); break;
  279. :)            }
  280. :)        }
  281. :)"a h"        printf("an '");
  282. :)"A h"        printf("An '");
  283. :)" h"        printf(" '");
  284. :)" H"        printf(" '");
  285. :)" C-"        printf(" Bruce Lee-");
  286. :)" C "        {        switch(rand()%4)
  287. :)             {
  288. :)             case 0: printf(" Bruce Lee "); break;
  289. :)             case 1: printf(" Circus Flea "); break;
  290. :)             case 2: printf(" Bumble Bee "); break;
  291. :)             case 3: printf(" Door Key "); break;
  292. :)             }
  293. :)        }
  294. :)" C."        printf(" Circus Flea.");
  295. :)Th        printf("F");
  296. :)Wh        printf("W");
  297. :)wh        printf("w");
  298. :)aw        printf("or");
  299. :)" sing"        ECHO;
  300. :)" ring"        ECHO;
  301. :)"ing "        printf("in' ");
  302. :)" th"        printf(" f");
  303. :)"th"        printf("ff");
  304. :)". "        {   switch(rand()%32)
  305. :)            {
  306. :)            case 0: printf(". I'll get out me spoons. "); break;
  307. :)            case 1: printf(". Yer can't 'ave a knees-up wivout a joanna. "); break;
  308. :)            case 2: printf(". Cor blimey guv, would I lie to you. "); break;
  309. :)            case 3: printf(". I'll make us all a nice cup of tea. "); break;
  310. :)            default: ECHO; break;
  311. :)            }
  312. :)        }
  313. :)"? "        {   switch(rand()%3)
  314. :)            {
  315. :)            case 0: printf(", mate? "); break;
  316. :)            case 1: printf(", guv? "); break;
  317. :)            case 2: printf(", squire? "); break;
  318. :)            }
  319. :)        }
  320. :)"! "        {   switch(rand()%6)
  321. :)            {
  322. :)            case 0: printf(", cor blimey! "); break;
  323. :)            case 1: printf("! Struth! "); break;
  324. :)            case 2: printf(", guv! "); break;
  325. :)            case 3: printf("! Honest guv! "); break;
  326. :)            case 4: printf(", mate! "); break;
  327. :)            case 5: ECHO; break;
  328. :)            }
  329. :)        }
  330. :).        printf(yytext);
  331. :)\n        printf("\n");
  332. :)%%
  333. :)
  334. :)main()
  335. :){
  336. :)    srand(getpid());
  337. :)    yylex();
  338. :)}
  339. FOO
  340. #    End of shell archive
  341. exit 0
  342.