Python l33t Translator

  • (2 Pages)
  • +
  • 1
  • 2

19 Replies - 6901 Views - Last Post: 17 November 2016 - 03:07 PM Rate Topic: -----

#16 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python l33t Translator

Posted 17 June 2012 - 04:58 AM

YAY. I've just posted the project on Google Code.
If you want to check it out please vist http://code.google.c...l33t-translator
Was This Post Helpful? 0
  • +
  • -

#17 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python l33t Translator

Posted 17 June 2012 - 05:42 AM

I have just created a new version of my module you can download it at the site or view it here it doesn't matter.
Here's the new version:
#Leet Translator
#This will translate
#Normal english into
#l33t.
#Credit to: baavgai
#Cladus - 15/06/2012
version = 4
def toLeet(text):
	leet = (
                (('are', 'Are'), 'r'),
                (('ate', 'Ate'), '8'),
                (('that', 'That'), 'tht'),
		(('you', 'You'), 'j00'),
		(('o', 'O'), '0'),
		(('i', 'I'), '1'),
		(('e', 'E'), '3'),
		(('s', 'S'), '5'),
		(('a', 'A'), '4'),
		(('t', 'T'), '7'),
		)
	for symbols, replaceStr in leet:
		for symbol in symbols:
			text = text.replace(symbol, replaceStr)
	return text
def toEnglish(leet):
	enga = {
		'0':'o',
		'1':'i',
		'3':'e',
		'5':'s',
		'4': 'a',
		't': '7',
                'r': 'are',
                '8': 'ate',
                'tht': 'that',
		'joo': 'you',
		}
	eng = (
		('0','o'),
		('1','i'),
		('3','e'),
		('5','s'),
		('4', 'a'),
		('7', 't'),
                (' r ', 'are'),
                ('8', 'ate'),
                ('tht', 'that'),
		('joo', 'you'),
		)
	for symbols, replaceStr in eng:
		leet = leet.replace(symbols, replaceStr)
	return leet


I added a new function called toEnglish(msg) witch will convert l33t to english!!!
Tell me what you think and if there are any bugs!
Was This Post Helpful? 0
  • +
  • -

#18 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python l33t Translator

Posted 17 June 2012 - 05:48 AM

I realized a mistake here's the new code:
#Leet Translator
#This will translate
#Normal english into
#l33t.
#Credit to: baavgai
#Cladus - 15/06/2012
version = 4
def toLeet(text):
	leet = (
                (('are', 'Are'), 'r'),
                (('ate', 'Ate'), '8'),
                (('that', 'That'), 'tht'),
		(('you', 'You'), 'j00'),
		(('o', 'O'), '0'),
		(('i', 'I'), '1'),
		(('e', 'E'), '3'),
		(('s', 'S'), '5'),
		(('a', 'A'), '4'),
		(('t', 'T'), '7'),
		)
	for symbols, replaceStr in leet:
		for symbol in symbols:
			text = text.replace(symbol, replaceStr)
	return text
def toEnglish(leet):
	eng = (
		('0','o'),
		('1','i'),
		('3','e'),
		('5','s'),
		('4', 'a'),
		('7', 't'),
                (' r ', 'are'),
                ('8', 'ate'),
                ('tht', 'that'),
		('joo', 'you'),
		)
	for symbols, replaceStr in eng:
		leet = leet.replace(symbols, replaceStr)
	return leet


Was This Post Helpful? 0
  • +
  • -

#19 cladus  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 25
  • Joined: 11-June 12

Re: Python l33t Translator

Posted 28 October 2012 - 03:00 AM

Hello,
This project is completed on its FINAL Version 4.0.
If any one would like to continue the project, the code is here: http://code.google.c...33t-translator/
Bye :)
Was This Post Helpful? 0
  • +
  • -

#20 kiocone  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-November 16

Re: Python l33t Translator

Posted 17 November 2016 - 03:07 PM

Hello, this is my first replay.
im glad to learn helping, i added a second level of l33t here is the code:
#Leet Translator V3.2
#This will translate
#Normal english into
#l33t. level 1 and 2
#Credit to: baavgai
#Cladus - 15/06/2012
#credit to: kiocone - 17/11/2016
def toLeet(text):
	global leet_level	
	if leet_level == 1:
		leet = (
           		    (('are', 'Are'), 'r'),
               		(('ate', 'Ate'), '8'),
               		(('that', 'That'), 'tht'),
			(('you', 'You', 'YOU'), 'j00'),
			(('o', 'O'), '0'),
			(('i', 'I'), '1'),
			(('e', 'E'), '3'),
			(('s', 'S'), '5'),
			(('a', 'A'), '4'),
			(('t', 'T'), '7'),
			)
	else:
		leet = (
           		    (('are', 'Are'), 'r'),
               		(('ate', 'Ate'), '8'),
               		(('that', 'That'), 'tht'),
			(('you', 'You', 'YOU'), 'j00'),
			(('o', 'O'), '()'),
			(('i', 'I'), '1'),
			(('e', 'E'), '3'),
			(('s', 'S'), '$'),
			(('a', 'A'), '4'),
			(('b', 'B'), '|3'),
			(('d', 'D'), '|)'),
			(('f', 'F'), '|='),
			(('g', 'G'), '6'),
			(('h', 'H'), '|-|'),
			(('j', 'J'), '_|'),
			(('k', 'K'), '|<'),
			(('l', 'L'), '|_'),
			(('m', 'M'), '|\/|'),
			(('n', 'N'), '|\|'),
			(('p', 'P'), '|>'),
			(('q', 'Q'), '()_'),
			(('r', 'R'), '|2'),
			(('t', 'T'), '+'),
			(('u', 'U'), '|_|'),
			(('v', 'V'), '\/'),
			(('w', 'W'), '|/|'),
			(('x', 'X'), '><'),
			(('y', 'Y'), '`/'),
			)
	for symbols, replaceStr in leet:
		for symbol in symbols:
			text = text.replace(symbol, replaceStr)
	return text

print("\t\t\t Python L33T Translator")
leet_level = raw_input("Enter L33t level [1] to 2: ")
if not leet_level:
	leet_level = 1
else:
	leet_level = int(leet_level)
if (leet_level == 1) or (leet_level == 2):
		message = raw_input("Please enter a message: ")
		print "Translated Message: ", toLeet(message)
else:
	print "Wrong L33t level"


Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2