Skip to content

Instantly share code, notes, and snippets.

@jbreams
Last active January 3, 2016 18:09
Show Gist options
  • Save jbreams/8500114 to your computer and use it in GitHub Desktop.
Save jbreams/8500114 to your computer and use it in GitHub Desktop.
This script will take the first command-line arguments and add as many umlauts as possible to it.
#!/usr/bin/python
# coding=utf8
import sys
umlauts = {
'A': [ 'Ä', 'Ǟ' ],
'a': [ 'ä', 'ǟ' ],
'E': [ 'Ë' ],
'e': [ 'ë' ],
'h': [ 'ḧ' ],
'H': [ 'Ḧ' ],
'I': [ 'Ḯ', 'Ḯ' ],
'i': [ 'ï', 'ḯ' ],
'O': [ 'Ö', 'Ȫ', 'Ṏ' ],
'o': [ 'ö', 'ȫ', 'ṏ' ],
'U': [ 'Ü', 'Ǖ', 'Ǘ', 'Ǚ', 'Ǜ', 'Ṳ', 'Ṻ' ],
'u': [ 'ü', 'ǖ', 'ǘ', 'ǚ', 'ǜ', 'ṳ', 'ṻ' ],
'W': [ 'Ẅ' ],
'w': [ 'ẅ' ],
'X': [ 'Ẍ' ],
'x': [ 'ẍ' ],
'Y': [ 'Ÿ' ],
'y': [ 'ÿ' ]
}
o = []
for c in sys.argv[1]:
if c in umlauts:
o.append(umlauts[c][0])
if len(umlauts[c]) > 1:
umlauts[c].pop(0)
else:
o.append(c)
print ''.join(o)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment