annotate python/accentuate.py @ 158:c1390e43b437

point pastebin at pastebin.mozilla
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 28 Jul 2011 09:18:15 -0700
parents e5c0188c5001
children 2de4b1d92c1c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
125
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 #!/usr/bin/env python
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 import random
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
136
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
6 mapping = {'a': ['Ȁ', 'ȁ', 'à', 'Ѧ'],
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
7 'b': ['Б'],
125
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 'c': ['ç'],
136
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
9 'e': ['ȅ', 'Ё', 'Є'],
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
10 'n': ['И', 'Й'],
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
11 'o': ['ổ', 'ȍ', 'Ѳ'],
146
e5c0188c5001 add another character
Jeff Hammel <jhammel@mozilla.com>
parents: 136
diff changeset
12 's': ['∫'],
125
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
13 't': ['Ṱ'],
136
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
14 'v': ['Ѵ'],
a612a16f11a7 add more craziness
Jeff Hammel <jhammel@mozilla.com>
parents: 126
diff changeset
15 'w': ['Ѡ', 'Щ']
125
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16 }
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 if __name__ == '__main__':
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
19 import sys
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
20 arg = ' '.join(sys.argv[1:])
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
21 retval = []
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
22 for letter in arg:
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
23 if letter.lower() in mapping:
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
24 retval.append(random.sample(mapping[letter.lower()], 1)[0])
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
25 else:
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
26 retval.append(letter)
a51df2382390 new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
27 print ''.join(retval)