Mercurial > hg > config
annotate python/accentuate.py @ 428:59e6c8115a97
.gitconfig
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 06 Aug 2013 23:08:42 -0700 |
parents | 342c121cbc30 |
children | c1f314c518c9 |
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 |
186 | 6 mapping = {'a': ['Ȁ', 'ȁ', 'à', 'Ѧ', 'ª', 'Å', 'Ą', 'ᥠ', 'Ӓ', 'ӑ', 'ά'], |
7 'b': ['Б', 'ß', 'ᛒ', 'ᙘ', '฿', 'ط', 'Ҍ','ъ', 'β', 'Ƀ'], | |
8 'c': ['ç', 'ᥴ', 'ᕩ', 'උ', 'ʗ'], | |
9 'd': ['Ð', 'đ', 'ժ', 'Ժ', 'Ԁ', 'ɗ', 'ȡ'], | |
10 'e': ['ȅ', 'Ё', 'Є', 'Ę', 'ᣰ', 'ع', 'Ҿ', 'Ҽ', 'ξ', 'έ', 'ɇ', 'Ȼ'], | |
11 'f': ['ᚫ', 'ഽ', 'ߓ', 'Ғ', 'ғ', 'ϝ'], | |
192 | 12 'g': ['Ꮆ', 'Ᏻ', 'ສ', 'ອ', 'ʛ', 'ɠ', 'ǵ', 'Ǵ', 'Ǥ', 'ğ'], |
186 | 13 'h': ['Ꮵ', 'ዝ', 'ߚ', 'ի', 'Ӊ', 'Ӈ', 'ӈ', 'Һ', 'Ҥ', 'ҥ', 'ђ', 'Ϧ'], |
195
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
14 'i': ['ו', 'ḯ', 'í', 'ї', 'ί', 'Ϊ', 'Ί', 'ɨ'], |
186 | 15 'j': ['ᒚ', 'ڷ', '˩', 'ʲ', 'ʝ', 'ȷ', 'ǰ'], |
16 'k': ['ԟ', 'Ԟ', 'Ӄ', 'Ҡ', 'Ҝ', 'ќ', 'ʞ'], | |
195
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
17 'l': ['£', '₤', 'ᥧ', 'ட', '˪', 'ʟ', 'ᶅ'], |
187
8e43a4f50e78
remove thing that doesnt exist
Jeff Hammel <jhammel@mozilla.com>
parents:
186
diff
changeset
|
18 'm': ['ញ', 'ᛖ', 'ጢ', 'ᆻ', 'ӎ', 'Ӎ',], |
186 | 19 'n': ['И', 'Й', 'א', 'ᥟ', 'ᜤ', '୩', 'Ӥ', 'Ҋ', 'η', 'ή'], |
20 'o': ['ổ', 'ȍ', 'Ѳ', '๏', 'Ӫ', 'ό', 'Ό', '˚', 'ʘ', 'Ȱ'], | |
21 'p': ['Ⴒ', 'թ', 'Ҏ', 'ҏ', 'ρ', 'Ƿ'], | |
22 'q': ['գ', 'ʠ', 'ɖ'], | |
23 'r': ['ᣨ', 'ჩ', 'я', 'Ɍ', 'ȓ', 'Ȓ', 'ȑ', 'Ȑ'], | |
195
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
24 's': ['∫', '§', 'ᛊ', 'Ꮥ', 'క', 'ˢ', 'ȿ', 'ș', 'ᶘ'], |
186 | 25 't': ['Ṱ', 'ל', 'ᛠ', 'ᚁ', 'ፕ', 'Է', 'Ե', 'Ҭ', 'Ϯ', 'ʈ', 'Ⱦ', 'ȶ'], |
233 | 26 'u': ['ṹ', 'ᥩ', 'ᥳ', 'ப', 'ն', 'Մ', 'μ', 'ǚ', 'μ'], |
186 | 27 'v': ['Ѵ', 'ᜥ', 'Ꮴ', 'Ѷ', 'ν', 'ΰ'], |
28 'w': ['Ѡ', 'Щ', 'ש', 'ឃ', 'ᜦ', 'Ꮤ', 'Ꮿ', 'ϣ'], | |
29 'x': ['χ', 'Ӽ', 'ӽ', 'Ҳ', 'ҳ', 'Ϫ', 'ˣ'], | |
30 'y': ['Ꭹ', 'Ꮍ','Ⴤ', 'Ӱ', 'Ӌ', 'ψ', 'Ϋ', 'Ύ', 'Ȳ'], | |
31 'z': ['ź', 'ʐ', 'ʑ', 'ɀ', 'Ȥ', 'ȥ'], | |
125
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
32 } |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
33 |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
34 if __name__ == '__main__': |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
35 import sys |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
36 arg = ' '.join(sys.argv[1:]) |
195
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
37 if not arg: |
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
38 arg = sys.stdin.read() |
125
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
39 retval = [] |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
40 for letter in arg: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
41 if letter.lower() in mapping: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
42 retval.append(random.sample(mapping[letter.lower()], 1)[0]) |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
43 else: |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
44 retval.append(letter) |
a51df2382390
new program that does silly things
Jeff Hammel <jhammel@mozilla.com>
parents:
diff
changeset
|
45 print ''.join(retval) |