I am trying to build a programme that will help me convert unicode abugida script into a list of vowels and consonants. I have achieved separation of phonetic sounds using the following script taken from Playing around with Devanagari characters
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unicodedata, sys
def splitclusters(s):
"""Generate the grapheme clusters for the string s. (Not the full
Unicode text segmentation algorithm, but probably good enough for
Devanagari.)
"""
virama = u'\N{DEVANAGARI SIGN VIRAMA}'
cluster = u''
last = None
for c in s:
cat = unicodedata.category(c)[0]
if cat == 'M' or cat == 'L' and last == virama:
cluster += c
else:
if cluster:
yield cluster
cluster = c
last = c
if cluster:
yield cluster
name_in_indic = raw_input('Enter your name in devanagari: ').decode('utf8')
print (','.join(list(splitclusters(name_in_indic))))
However, my intention is to go further and separate all the vowels and consonants .
E.g हिंदी = ह+इ+न+द+ई
which is the same as hindi becoming h+i+n+d+i only in indic scripts each phoneme is treating as a character
How do i go about this?