Created
March 9, 2011 21:59
-
-
Save sbp/863099 to your computer and use it in GitHub Desktop.
vowel munger
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # coding=utf-8 | |
| import sys, re, random | |
| r_vowel = re.compile(r'[aeiou]') | |
| def rand(m): | |
| return random.choice(u'áéíóúâêîôûäëïöüáéíóúâêîôûäëïöüaeiou') | |
| for line in sys.stdin: | |
| line = line.decode('utf-8') | |
| line = r_vowel.sub(rand, line) | |
| sys.stdout.write(line.encode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment