Mercurial > hg > config
annotate python/accentuate.py @ 161:2de4b1d92c1c
add an L symbol
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 02 Aug 2011 13:24:21 -0700 |
parents | e5c0188c5001 |
children | 01fb9051faf8 |
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 | 6 mapping = {'a': ['Ȁ', 'ȁ', 'à', 'Ѧ'], |
7 'b': ['Б'], | |
125
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
8 'c': ['ç'], |
136 | 9 'e': ['ȅ', 'Ё', 'Є'], |
161 | 10 'l': ['£', '₤'], |
136 | 11 'n': ['И', 'Й'], |
12 'o': ['ổ', 'ȍ', 'Ѳ'], | |
146 | 13 's': ['∫'], |
125
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
14 't': ['Ṱ'], |
136 | 15 'v': ['Ѵ'], |
16 'w': ['Ѡ', 'Щ'] | |
125
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 |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
19 if __name__ == '__main__': |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
20 import sys |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
21 arg = ' '.join(sys.argv[1:]) |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
22 retval = [] |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
23 for letter in arg: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
24 if letter.lower() in mapping: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
25 retval.append(random.sample(mapping[letter.lower()], 1)[0]) |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
26 else: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
27 retval.append(letter) |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
28 print ''.join(retval) |