All pastes #79505 Raw Edit

gr2gl

public python v1 · immutable
·published 2006-07-05 13:21 UTC
rendered paste body
#!/usr/bin/env python"""Converts Greek strings to Greeklish."""__author__ = 'Indy Micro <indy90@gmail.com>'__date__ = '5-7-2006'__version__ = '1.0'__license__ = 'GPL'__copyright__ = 'Copyright (c) Indy Micro, 2006-2007'Corresponding = {	"\xce\xb1" : 'a' ,	"\xce\xac" : 'a' ,	"\xce\xb2" : 'b' ,	"\xce\xb3" : 'g' ,	"\xce\xb4" : 'd' ,	"\xce\xb5" : 'e' ,	"\xce\xad" : 'e' ,	"\xce\xb6" : 'z' ,	"\xce\xb7" : 'h' ,	"\xce\xae" : 'h' ,	"\xce\xb8" : '8' ,	"\xce\xb9" : 'i' ,	"\xce\xaf" : 'i' ,	"\xce\xba" : 'k' ,	"\xce\xbb" : 'l' ,	"\xce\xbc" : 'm' ,	"\xce\xbd" : 'n' ,	"\xce\xbe" : '3' ,	"\xce\xbf" : 'o' ,	"\xcf\x8c" : 'o' ,	"\xcf\x80" : 'p' ,	"\xcf\x81" : 'r' ,	"\xcf\x82" : 's' ,	"\xcf\x83" : 's' ,	"\xcf\x84" : 't' ,	"\xcf\x85" : 'u' ,	"\xcf\x8d" : 'u' ,	"\xcf\x86" : 'f' ,	"\xcf\x87" : 'x' ,	"\xcf\x88" : 'y' ,	"\xcf\x89" : 'w' ,	"\xcf\x8e" : 'w' ,	"\xce\x91" : 'A' ,	"\xce\x86" : 'A' ,	"\xce\x92" : 'B' ,	"\xce\x93" : 'G' ,	"\xce\x94" : 'D' ,	"\xce\x95" : 'E' ,	"\xce\x88" : 'E' ,	"\xce\x96" : 'Z' ,	"\xce\x97" : 'H' ,	"\xce\x89" : 'H' ,	"\xce\x98" : '8' ,	"\xce\x99" : 'I' ,	"\xce\x8a" : 'I' ,	"\xce\x9a" : 'K' ,	"\xce\x9b" : 'L' ,	"\xce\x9c" : 'M' ,	"\xce\x9d" : 'N' ,	"\xce\x9e" : '3' ,	"\xce\x9f" : 'O' ,	"\xce\x8c" : 'O' ,	"\xce\xa0" : 'P' ,	"\xce\xa1" : 'R' ,	"\xce\xa2" : 'S' ,	"\xce\xa3" : 'T' ,	"\xce\xa4" : 'U' ,	"\xce\x8e" : 'U' ,	"\xce\xa6" : 'F' ,	"\xce\xa7" : 'X' ,	"\xce\xa8" : 'Y' ,	"\xce\xa9" : 'W' ,	"\xce\x8f" : 'W'}def gr2gl( Greek ) :	Greeklish = []	for Character in Greek :		Greeklish.append( Corresponding.get( Character , Character ) )	return ''.join( Greeklish )if __name__ == '__main__' :	import sys	try :		for Argument in sys.argv[ 1 : ] :			print gr2gl( Argument ) ,	except :		import os		print 'usage: %s here go greek words' % os.path.basename( sys.path[ 0 ] )