Skip to content

Instantly share code, notes, and snippets.

@nivir
Created August 13, 2014 11:23
Show Gist options
  • Save nivir/0f9f7030f44379941a9b to your computer and use it in GitHub Desktop.
Save nivir/0f9f7030f44379941a9b to your computer and use it in GitHub Desktop.
Random Testing code for extract vowel
__author__ = 'Roy'
def extract_vowels():
letters = 'abcdefghijklmnopqrstuvwxyz'
pos = dict(zip(xrange(1, 27), letters))
print pos
alphabet = [chr(i) for i in xrange(97, 123)]
print alphabet
# generate a list of vowels
vowels = map(lambda x: chr(x), reduce(lambda acc, i: acc + [acc[-1] + i], (4, 4, 6, 6, 4), [97]))
print vowels
codepoints = reduce(lambda acc, i: acc + [acc[-1] + i], (4, 4, 6, 6, 4), [97])
print codepoints
consolants = [i for i in alphabet if i not in vowels]
print consolants
print pos
vowlz = map(lambda x: pos[x], reduce(lambda acc, i: acc + [acc[-1] + i], (4, 4, 6, 6, 4), [1]))
print vowlz
vowels1 = lambda step, start: map(lambda x: chr(x),
reduce(lambda acc, i: acc + [acc[-1] + i], [4, 4, 6, 6, step], [start]))
vowels1 = lambda step, start: map(lambda x: chr(x),
reduce(lambda acc, i: acc + [acc[-1] + i], [4, 4, 6, 6, step], [start]))
vowels1(step=4, start=65)
print vowels
if __name__ == '__main__':
extract_vowels()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment