# ITP Thesis Buzzkiller # Adam Parrish # ITP Spring 2008 import re import random import sys class BuzzKiller(object): # coding # - vt: transitive verb # - vt3: transitive verb w/3rd person present inflection # - vtpp: transitive verb present participle # - vtpa: transitive verb past tense # (vi*: intransitive verb) # - n: noun # - np: plural noun # - adj: adjective BUZZWORDS = [ ('explore', 'vt'), ('explores', 'vt3'), ('exploring', 'vtpp'), ('explored', 'vtpa'), ('exploration', 'n'), ('explorations', 'np'), ('interactive', 'adj'), ('interactivity', 'n'), ('interaction', 'n'), ('interactions', 'np'), ('interact', 'vi'), ('interacts', 'vi3'), ('interacting', 'vipp'), ('space', 'n'), ('spaces', 'np'), ('user-generated', 'adj'), ('social', 'adj'), ('platform', 'n'), ('platforms', 'np'), ('mediate', 'vt'), ('mediates', 'vt3'), ('mediating', 'adj/vtpp'), ('mediated', 'adj/vtpa'), ('object', 'n'), ('objects', 'np'), ('subvert', 'vt'), ('subverts', 'vt3'), ('subverting', 'adj/vtpp'), ('subverted', 'adj/vtpa'), ('subversion', 'n'), ('subversive', 'adj'), ('interface', 'n/vi'), ('interfaces', 'np/vi3'), ('interfacing', 'vipp'), ('interfaced', 'vipa'), ('paradigm', 'n'), ('paradigms', 'np'), ('system', 'n'), ('systems', 'np'), ('innovate', 'vi'), ('innovates', 'vi3'), ('innovating', 'vipp'), ('innovated', 'vipa'), ('innovative', 'adj'), ('multimedia', 'adj/n'), ('engage', 'vt'), ('engages', 'vt3'), ('engaging', 'adj/vtpp'), ('engaged', 'adj/vtpa'), ('pervasive', 'adj'), ('pervasiveness', 'n'), ('ubiquitous', 'adj'), ('ubiquity', 'n'), ('visualize', 'vt'), ('visualizes', 'vt3'), ('visualizing', 'vtpp'), ('visualized', 'vtpa'), ('visualization', 'n'), ('visualization', 'np'), ('performative', 'adj'), ('performativity', 'n'), ('mobile', 'adj'), ('mobility', 'n'), ('android', 'n'), ('geo-?tag', 'vt'), ('geo-?tags', 'vt3'), ('geo-?tagging', 'adj/vtpp'), ('geo-?tagged', 'vtpa'), ('virtual', 'adj/n'), ('sensory', 'adj'), ('personalize', 'vt'), ('personalizes', 'vt3'), ('personalizing', 'vtpp'), ('personalized', 'adj/vtpa'), ('personalization', 'n'), ('synchronize', 'vt'), ('synchronizes', 'vt3'), ('synchronizing', 'vtpp'), ('synchronized', 'adj/vtpa'), ('open-?source', 'adj'), ('open-?sources', 'vt3'), ('open-?sourced', 'vtpa'), ('open-?sourcing', 'vtpp'), ('synergize', 'vi'), ('synergizes', 'vi3'), ('synergizing', 'vi3'), ('synergized', 'vipa'), ('synergy', 'n'), ('process', 'n/vt'), ('processes', 'np/vt3'), ('empower', 'vt'), ('empowers', 'vt3'), ('empowering', 'adj/vtpp'), ('empowered', 'adj/vtpa'), ('empowerment', 'n'), ('content', 'n'), ('cyborg', 'n'), ('cyborgs', 'np'), ('technology', 'n'), ('technological', 'adj'), ('technologies', 'np'), ('develop', 'vt'), ('developing', 'adj/vtpp'), ('developed', 'adj/vtpa'), ('development', 'n'), ('wearable', 'adj/n'), ('wearables', 'np'), ('abstract', 'adj/n'), ('abstracts', 'np/vt3'), ('abstracting', 'vtpp'), ('abstracted', 'adj/vtpa'), ('appropriate', 'adj/vt'), ('appropriates', 'vt3'), ('appropriating', 'vtpp'), ('appropriated', 'vtpa'), ('dynamic', 'adj/n'), ('dynamics', 'np'), ('(re-)?examine', 'vt'), ('(re-)?examines', 'vt3'), ('(re-)?examining', 'vtpp'), ('(re-)?examined', 'vtpa'), ('(re-)?examination','n'), ('immerse', 'vt'), ('immerses', 'vt3'), ('immersing', 'vtpp'), ('immersive', 'adj'), ('immersed', 'vtpa'), ('invert', 'vt'), ('inverts', 'vt3'), ('inverting', 'vtpp'), ('inverted', 'adj/vtpa'), ('locative', 'adj'), ('manifest', 'adj/vt'), ('manifests', 'np/vt3'), ('manifesting', 'vtpp'), ('manifested', 'vtpa'), ('manifestation', 'n'), ('reductive', 'adj'), ('situate', 'vt'), ('situates', 'vt3'), ('situating', 'vtpp'), ('situated', 'adj/vtpa'), ('situational', 'adj'), ('temporal', 'adj'), ('algorithm', 'n'), ('progressive', 'adj'), ('question', 'n/vt'), ('questions', 'np/vt3'), ('questioning', 'vtpp'), ('questioned', 'vtpa'), ('reading', 'n/vtpp'), ] REPLACEMENTS = ( ('spit', 'vi'), ('adhere', 'vi'), ('emanate', 'vi'), ('belong', 'vi'), ('flee', 'vi'), ('clear', 'vi'), ('bud', 'vi'), ('rise', 'vi'), ('sing', 'vi'), ('gravitate', 'vi'), ('jog', 'vi'), ('default', 'vi'), ('atrophy', 'vi'), ('converge', 'vi'), ('screech', 'vi'), ('babble', 'vi'), ('tickle', 'vi'), ('stutter', 'vi'), ('sniff', 'vi'), ('spits', 'vi3'), ('emanates', 'vi3'), ('belongs', 'vi3'), ('flees', 'vi3'), ('clears', 'vi3'), ('buds', 'vi3'), ('rises', 'vi3'), ('sings', 'vi3'), ('squirts', 'vi3'), ('functions', 'vi3'), ('chortles', 'vi3'), ('gravitates', 'vi3'), ('jogs', 'vi3'), ('defaults', 'vi3'), ('atrophies', 'vi3'), ('converges', 'vi3'), ('snorts', 'vi3'), ('babbles', 'vi3'), ('unravels', 'vi3'), ('consists', 'vi3'), ('lingering', 'vipp'), ('suffering', 'vipp'), ('peering', 'vipp'), ('embarking', 'vipp'), ('daring', 'vipp'), ('spitting', 'vipp'), ('budding', 'vipp'), ('chortling', 'vipp'), ('jogging', 'vipp'), ('babbling', 'vipp'), ('sobbing', 'vipp'), ('slept', 'vipa'), ('arraigned', 'vipa'), ('surfed', 'vipa'), ('swarmed', 'vipa'), ('adhered', 'vipa'), ('jogged', 'vipa'), ('converged', 'vipa'), ('functioned', 'vipa'), ('sung', 'vipa'), ('withered', 'vipa'), ('proliferated', 'vipa'), ('babbled', 'vipa'), ('chatted', 'vipa'), ('unroll', 'vt'), ('kneed', 'vt'), ('plaster', 'vt'), ('commercialize', 'vt'), ('intimidate', 'vt'), ('split', 'vt'), ('tar', 'vt'), ('generalize', 'vt'), ('mesmerize', 'vt'), ('entail', 'vt'), ('garnish', 'vt'), ('reboot', 'vt'), ('highlight', 'vt'), ('grope', 'vt'), ('fight', 'vt'), ('rankles', 'vt3'), ('caches', 'vt3'), ('withholds', 'vt3'), ('raises', 'vt3'), ('mills', 'vt3'), ('dislikes', 'vt3'), ('bites', 'vt3'), ('condones', 'vt3'), ('cuckolds', 'vt3'), ('forecasts', 'vt3'), ('judges', 'vt3'), ('scans', 'vt3'), ('insinuates', 'vt3'), ('usurps', 'vt3'), ('tastes', 'vt3'), ('mans', 'vt3'), ('utilizes', 'vt3'), ('deletes', 'vt3'), ('snorts', 'vt3'), ('badgers', 'vt3'), ('shepherding', 'vtpp'), ('bombarding', 'vtpp'), ('retaking', 'vtpp'), ('whacking', 'vtpp'), ('industrializing', 'vtpp'), ('filching', 'vtpp'), ('citing', 'vtpp'), ('combating', 'vtpp'), ('spinning', 'vtpp'), ('adjusting', 'vtpp'), ('attending', 'vtpp'), ('remembering', 'vtpp'), ('malfunctioning', 'vtpp'), ('sweeping', 'vtpp'), ('inflating', 'vtpp'), ('allocating', 'vtpp'), ('banishing', 'vtpp'), ('articulating', 'vtpp'), ('respecting', 'vtpp'), ('gloved', 'vtpa'), ('covered', 'vtpa'), ('averred', 'vtpa'), ('impeded', 'vtpa'), ('uploaded', 'vtpa'), ('housed', 'vtpa'), ('jerked', 'vtpa'), ('merged', 'vtpa'), ('phoned', 'vtpa'), ('blowtorched', 'vtpa'), ('snagged', 'vtpa'), ('entered', 'vtpa'), ('dialed', 'vtpa'), ('pressured', 'vtpa'), ('surfed', 'vtpa'), ('widowed', 'vtpa'), ('engraved', 'vtpa'), ('fabricated', 'vtpa'), ('seduced', 'vtpa'), ('fondled', 'vtpa'), ('redecorated', 'vtpa'), ('estimated', 'vtpa'), ('rickety', 'adj'), ('gloved', 'adj'), ('persistent', 'adj'), ('adventuresome', 'adj'), ('easier', 'adj'), ('covered', 'adj'), ('royalist', 'adj'), ('vulgar', 'adj'), ('undescended', 'adj'), ('rebellious', 'adj'), ('cordless', 'adj'), ('male', 'adj'), ('past', 'adj'), ('coarse', 'adj'), ('spinning', 'adj'), ('bitchy', 'adj'), ('lingering', 'adj'), ('suffering', 'adj'), ('attending', 'adj'), ('engraved', 'adj'), ('midsize', 'adj'), ('malfunctioning', 'adj'), ('fabricated', 'adj'), ('fundamental', 'adj'), ('sweeping', 'adj'), ('daring', 'adj'), ('salvageable', 'adj'), ('clumsy', 'adj'), ('libidinous', 'adj'), ('estimated', 'adj'), ('recluse', 'n'), ('historicism', 'n'), ('royalist', 'n'), ('scarf', 'n'), ('exception', 'n'), ('grudge', 'n'), ('editorship', 'n'), ('pharmacist', 'n'), ('spacesuit', 'n'), ('brink', 'n'), ('swath', 'n'), ('masonry', 'n'), ('nanotube', 'n'), ('sunshine', 'n'), ('male', 'n'), ('past', 'n'), ('fever', 'n'), ('psychiatrist', 'n'), ('plaster', 'n'), ('tar', 'n'), ('catnap', 'n'), ('jog', 'n'), ('hobgoblin', 'n'), ('garnish', 'n'), ('kryptonite', 'n'), ('default', 'n'), ('screech', 'n'), ('tickle', 'n'), ('seekers', 'np'), ('throats', 'np'), ('shotguns', 'np'), ('mills', 'np'), ('dislikes', 'np'), ('hotels', 'np'), ('sexaholics', 'np'), ('bites', 'np'), ('loaves', 'np'), ('tweezers', 'np'), ('restructurings', 'np'), ('cuckolds', 'np'), ('forecasts', 'np'), ('judges', 'np'), ('scans', 'np'), ('protons', 'np'), ('buds', 'np'), ('kissers', 'np'), ('rises', 'np'), ('squirts', 'np'), ('functions', 'np'), ('girlfriends', 'np'), ('bosoms', 'np'), ('badgers', 'np'), ('covered', 'adj'), ('saddened', 'adj'), ('saddened', 'vtpa'), ('part', 'n'), ('part', 'vt'), ('credit', 'vt'), ('credit', 'n'), ('level', 'adj'), ('level', 'vt'), ('thinks', 'vt3'), ('scientific', 'adj'), ('prospects', 'vt3'), ('prospects', 'np'), ('dig', 'vi'), ('dig', 'vt'), ('decay', 'vi'), ('distress', 'vt'), ('distress', 'n'), ('slowing', 'adj'), ('slowing', 'vtpp'), ('boil', 'n'), ('boil', 'vi'), ('exceeds', 'vt3'), ('hookups', 'np'), ('reprinting', 'vtpp'), ('pharmacology', 'n'), ('cryptofascist', 'adj'), ('wedge', 'vi'), ('wedge', 'n'), ('haggle', 'vi'), ('haggles', 'vi3'), ('haunt', 'vt'), ('haunt', 'n'), ('bluff', 'vi'), ('bluff', 'n'), ('costumed', 'adj'), ('vintage', 'adj'), ('wrench', 'n'), ('wrench', 'vt'), ('wrenching', 'adj'), ('wrenching', 'vtpp'), ('rescinded', 'adj'), ('rescinded', 'vtpa'), ('halibut', 'n'), ('entendres', 'np'), ('seducing', 'adj'), ('seducing', 'vtpp'), ('glance', 'n'), ('glance', 'vi'), ('glances', 'np'), ('glances', 'vi3'), ('glancing', 'vipp'), ('glanced', 'vipa'), ('seconds', 'vt3'), ('seconds', 'np'), ('bargain', 'adj'), ('bargain', 'n'), ('position', 'vt'), ('position', 'n'), ('positions', 'vt3'), ('positions', 'np'), ('minute', 'adj'), ('minute', 'n'), ('scrap', 'n'), ('scrap', 'vt'), ('spackling', 'n'), ('spackling', 'vtpp'), ('gathering', 'n'), ('gathering', 'vtpp'), ('deck', 'n'), ('deck', 'vt'), ('captive', 'adj'), ('captive', 'n'), ('zip', 'vt'), ) def __init__(self): self.replace = {} # create initial list of replacements in dicts for pair in self.REPLACEMENTS: if not(self.replace.has_key(pair[1])): self.replace[pair[1]] = [] self.replace[pair[1]].append(pair[0]) # create dicts that contain intersections of other dicts toadd = {} for d in self.replace: for e in [item for item in self.replace if item != d]: for val in self.replace[d]: if val in self.replace[e]: keylist = [e, d]; keylist.sort() keystr = "%s/%s" % tuple(keylist) if not(toadd.has_key(keystr)): toadd[keystr] = [] toadd[keystr].append(val) self.replace.update(toadd) def transform(self, str): for word in self.BUZZWORDS: str = re.sub(r'(?i)((?<=\ba)n)?( ?)\b(%s)\b' % (word[0]), r'\2%s' % (random.choice(self.replace[word[1]]).upper()), str) return str if __name__ == '__main__': # handle command line if len(sys.argv) == 3: input = open(sys.argv[1], 'r') output = open(sys.argv[2], 'w') elif len(sys.argv) == 1: input = sys.stdin output = sys.stdout else: sys.stderr.write("Usage: buzzkiller.py infile outfile\n") sys.stderr.write("(you can also use stdin and stdout)\n") sys.exit(1) killer = BuzzKiller() for line in input: output.write(killer.transform(line))