#!/usr/bin/env python import sys import cgi import cgitb cgitb.enable() # Really simple and stupid, just a search and replace on strings # The intelligent way to do it, # would be to find an English <-> International Phonetic Alphabet convertor # and then do search and replace on the IPA, before reformating English-wise def bostonify(sentence): translationTable = [ ('very','wicked'), ('wonderful','wicked'), ('awesome','wicked'), ('excellent','wicked'), ('superb','wicked'), ('great','wicked'), ('pture', 'psha'), ('sure', 'shuh'), ('our', 'auh'), ('you', 'ya'), ('are', 'ah'), ('ere', 'eah'), ('their', 'theyr'), ('eir', 'ey'), ('ar','ah'), ('er', 'ah'), ('a a', 'ar a'), ('a e', 'ar e'), ('a i', 'ar i'), ('a o', 'ar o'), ('a u', 'ar u'), ('ign', 'iyn'), ('ia', 'iya'), ('or', 'oah'), ('oy', 'oi'), ('aw a', 'awr a'), ('aw e', 'awr e'), ('aw i', 'awr i'), ('aw o', 'awr o'), ('aw u', 'awr u'), ('at ', "ah "), ("'re", "'a"), ("ing ", "in' ")] for inputLetters, outputLetters in translationTable: sentence = sentence.replace(inputLetters, outputLetters) return sentence def main(): form = cgi.FieldStorage() try: text = form.getfirst('TranslateText') translated = bostonify(text) except: translated = "" text = \ """ That there are intertwined histories, different cultures and, more generally, differences already abundant in one and the 'same' individual, that the world is multicolored, that one must let people live, eat, dress, imagine, love in whichever way they please, is not the issue whatever certain disingenuous simpletons may want us to think. Such liberal truisms are cheap, and one would only like to see those who proclaim them not react so violently whenever confronted with the slightest serious attempt to dissent from their own puny liberal difference. Contemporary cosmopolitanism is a beneficent reality. We simply ask that its partisans not get themselves worked up at the sight of a young veiled woman, lest we begin to fear that what they really desire, far from a real web of shifting differences, is the uniform dictatorship of what they take to be 'modernity'. --Alain Badiou """ print "Content-Type: text/html" print print \ """ Bostonifier

The Bostonifier

Quickly and painlessly convert standard English into Bostonian dialect.
by Mark Luffel 2004

%s


"""%(translated, text) if __name__ == '__main__': main()