annotate python/accentuate.py @ 725:55a9ba575605

i need this actually for cdwin
author Jeff Hammel <k0scist@gmail.com>
date Wed, 05 Nov 2014 13:58:49 -0800
parents 342c121cbc30
children c1f314c518c9
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
186
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
6 mapping = {'a': ['Ȁ', 'ȁ', 'à', 'Ѧ', 'ª', 'Å', 'Ą', 'ᥠ', 'Ӓ', 'ӑ', 'ά'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
7 'b': ['Б', 'ß', 'ᛒ', 'ᙘ', '฿', 'ط', 'Ҍ','ъ', 'β', 'Ƀ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
8 'c': ['ç', 'ᥴ', 'ᕩ', 'උ', 'ʗ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
9 'd': ['Ð', 'đ', 'ժ', 'Ժ', 'Ԁ', 'ɗ', 'ȡ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
10 'e': ['ȅ', 'Ё', 'Є', 'Ę', 'ᣰ', 'ع', 'Ҿ', 'Ҽ', 'ξ', 'έ', 'ɇ', 'Ȼ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
11 'f': ['ᚫ', 'ഽ', 'ߓ', 'Ғ', 'ғ', 'ϝ'],
192
4b9f353fc416 add a g
Jeff Hammel <jhammel@mozilla.com>
parents: 187
diff changeset
12 'g': ['Ꮆ', 'Ᏻ', 'ສ', 'ອ', 'ʛ', 'ɠ', 'ǵ', 'Ǵ', 'Ǥ', 'ğ'],
186
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
13 'h': ['Ꮵ', 'ዝ', 'ߚ', 'ի', 'Ӊ', 'Ӈ', 'ӈ', 'Һ', 'Ҥ', 'ҥ', 'ђ', 'Ϧ'],
195
171bd3b71e84 more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents: 192
diff changeset
14 'i': ['ו', 'ḯ', 'í', 'ї', 'ί', 'Ϊ', 'Ί', 'ɨ'],
186
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
15 'j': ['ᒚ', 'ڷ', '˩', 'ʲ', 'ʝ', 'ȷ', 'ǰ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
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
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
19 'n': ['И', 'Й', 'א', 'ᥟ', 'ᜤ', '୩', 'Ӥ', 'Ҋ', 'η', 'ή'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
20 'o': ['ổ', 'ȍ', 'Ѳ', '๏', 'Ӫ', 'ό', 'Ό', '˚', 'ʘ', 'Ȱ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
21 'p': ['Ⴒ', 'թ', 'Ҏ', 'ҏ', 'ρ', 'Ƿ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
22 'q': ['գ', 'ʠ', 'ɖ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
23 'r': ['ᣨ', 'ჩ', 'я', 'Ɍ', 'ȓ', 'Ȓ', 'ȑ', 'Ȑ'],
195
171bd3b71e84 more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents: 192
diff changeset
24 's': ['∫', '§', 'ᛊ', 'Ꮥ', 'క', 'ˢ', 'ȿ', 'ș', 'ᶘ'],
186
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
25 't': ['Ṱ', 'ל', 'ᛠ', 'ᚁ', 'ፕ', 'Է', 'Ե', 'Ҭ', 'Ϯ', 'ʈ', 'Ⱦ', 'ȶ'],
233
342c121cbc30 another μ
Jeff Hammel <jhammel@mozilla.com>
parents: 195
diff changeset
26 'u': ['ṹ', 'ᥩ', 'ᥳ', 'ப', 'ն', 'Մ', 'μ', 'ǚ', 'μ'],
186
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
27 'v': ['Ѵ', 'ᜥ', 'Ꮴ', 'Ѷ', 'ν', 'ΰ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
28 'w': ['Ѡ', 'Щ', 'ש', 'ឃ', 'ᜦ', 'Ꮤ', 'Ꮿ', 'ϣ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
29 'x': ['χ', 'Ӽ', 'ӽ', 'Ҳ', 'ҳ', 'Ϫ', 'ˣ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
30 'y': ['Ꭹ', 'Ꮍ','Ⴤ', 'Ӱ', 'Ӌ', 'ψ', 'Ϋ', 'Ύ', 'Ȳ'],
d22c6079a806 now has a full alphabet
Jeff Hammel <jhammel@mozilla.com>
parents: 185
diff changeset
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)