Mercurial > hg > config
annotate python/accentuate.py @ 924:fc88a12acf48 default tip
add lfs filter
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Wed, 04 Dec 2024 15:50:53 -0800 |
parents | 0c505e8fdad7 |
children |
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': ['ញ', 'ᛖ', 'ጢ', 'ᆻ', 'ӎ', 'Ӎ',], |
771 | 19 'n': ['И', 'Й', 'א', 'ᥟ', 'ᜤ', '୩', 'Ӥ', 'Ҋ', 'η', 'ή', 'и'], |
186 | 20 'o': ['ổ', 'ȍ', 'Ѳ', '๏', 'Ӫ', 'ό', 'Ό', '˚', 'ʘ', 'Ȱ'], |
21 'p': ['Ⴒ', 'թ', 'Ҏ', 'ҏ', 'ρ', 'Ƿ'], | |
22 'q': ['գ', 'ʠ', 'ɖ'], | |
771 | 23 'r': ['ჩ', 'я', 'Ɍ', 'ȓ', 'Ȓ', 'ȑ', 'Ȑ'], |
195
171bd3b71e84
more letters + read from stdin
Jeff Hammel <jhammel@mozilla.com>
parents:
192
diff
changeset
|
24 's': ['∫', '§', 'ᛊ', 'Ꮥ', 'క', 'ˢ', 'ȿ', 'ș', 'ᶘ'], |
771 | 25 't': ['Ṱ', 'ל', 'ᛠ', 'ᚁ', 'ፕ', 'Է', 'Ե', 'Ҭ', 'Ϯ', 'ʈ', 'Ⱦ', 'ȶ', 'イ'], |
233 | 26 'u': ['ṹ', 'ᥩ', 'ᥳ', 'ப', 'ն', 'Մ', 'μ', 'ǚ', 'μ'], |
771 | 27 'v': ['Ѵ', 'ᜥ', 'Ꮴ', 'Ѷ', 'ν', 'ΰ', 'γ'], |
186 | 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) |
868 | 45 print (''.join(retval)) |