Skip to content

Instantly share code, notes, and snippets.

@sbp
Created March 9, 2011 21:59
Show Gist options
  • Select an option

  • Save sbp/863099 to your computer and use it in GitHub Desktop.

Select an option

Save sbp/863099 to your computer and use it in GitHub Desktop.
vowel munger
#!/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