#l33t1z3r.py ( elitizer.py ) # #Oguz Yetkin #Demo program to combine words into so-called "elite" speak #from l33t1z3r import * tl1 = ['A','a'] tl2 = ['B','b'] tl3 = [] d = {} d['A'] = ['A','a','4','@'] d['a'] = ['A','a','4','@'] d['B'] = ['B','b','6','|o','1o','lo','8'] d['b'] = ['B','b','6','|o','1o','lo','8'] d['C'] = ['C','c','('] d['c'] = ['C','c','('] d['D'] = ['D','d'] d['d'] = ['D','d'] d['E'] = ['E','e','3'] d['e'] = ['E','e','3'] d['F'] = ['F','f'] d['f'] = ['F','f'] d['G'] = ['G','g','6','9','q'] d['g'] = ['G','g','6','9','q'] d['H'] = ['H','h'] d['h'] = ['H','h'] d['I'] = ['I','i','l','1','|'] d['i'] = ['I','i','l','1','|'] d['J'] = ['J','j'] d['j'] = ['J','j'] d['K'] = ['K','k','|<','1<','l<'] d['k'] = ['K','k','|<','1<','l<'] d['L'] = ['L','l','[','I','i','1','|'] d['l'] = ['L','l','[','I','i','1','|'] d['M'] = ['M','m','%','^^'] d['m'] = ['M','m','%','^^'] d['N'] = ['N','n','^','&'] d['n'] = ['N','n','^','&'] d['O'] = ['O','o','0'] d['o'] = ['O','o','0'] d['P'] = ['P','p'] d['p'] = ['P','p'] d['Q'] = ['Q','q','g','9'] d['q'] = ['Q','q','g','9'] d['R'] = ['R','r'] d['r'] = ['R','r'] d['S'] = ['S','s','3','8'] d['s'] = ['S','s','3','8'] d['T'] = ['T','t','7'] d['t'] = ['T','t','7'] d['U'] = ['U','u','V','v'] d['u'] = ['U','u','V','v'] d['V'] = ['V','v','U','u','\/','5'] d['v'] = ['V','v','U','u','\/','5'] d['W'] = ['W','w','vv'] d['w'] = ['W','w','vv'] d['X'] = ['X','x','%','*'] d['x'] = ['X','x','%','*'] d['Y'] = ['Y','y','y'] d['y'] = ['Y','y','y','\|/'] d['Z'] = ['Z','z','3'] d['z'] = ['Z','z','3'] d['1'] = ['1','l','|','L','[','I','i'] d['2'] = ['2','Z'] d['3'] = ['3','e','E'] d['4'] = ['4','A'] d['5'] = ['5','V'] d['6'] = ['6','G'] d['7'] = ['7','T'] d['8'] = ['8','S'] d['9'] = ['9','g'] d['0'] = ['O','o','0'] def combineLists(list1,list2): """ return combination of all list elements list1: list such as ['A','a'] list2: list such as ['B','b'] return: [['AB'],['Ab'], ['aB'], ['ab']] """ resultList=[] result = "" for letter1 in list1: for letter2 in list2: result = letter1 + letter2 #print "result is " + str(result) resultList.append(result) return resultList def getVariants(inStr,depth): """ returns all punctuation/number variants of inStr """ retList = [] strList = list(inStr) comboList = [] for i in strList: try: comboList += [d[i][:depth]] except: comboList += [i] #print "comboList is: " + str(comboList) #TODO: iterate through list creating all combinations comboList.reverse() masterList = comboList.pop() while(len(comboList) > 0): masterList = combineLists(masterList, comboList.pop()) return masterList import sys depth = 3 if __name__ == "__main__": if len(sys.argv) < 2: print "use: %s word [-depth DEPTH]"%(sys.argv[0]) else: if len(sys.argv) >= 4: if sys.argv[2] == "-depth": depth = int(sys.argv[3]) retList = getVariants(sys.argv[1],depth) for i in retList: print i