1

The title was vague so I will fill you in on what I am saying:

I want to in Python be able to determine the root character of a character, like this:

ǻ + [backspace] = å = a meaning that the root character of ǻ is a

1 Answer 1

2

You could use the unicodedata.normalize function for this:

from unicodedata import normalize

letter = 'ǻ'
letter = normalize('NFD', letter)
print(letter[0]) # a

unicodedata.normalize('NFD', s) translates each the string into its decomposed form.

An easier and more reliable method, however, is to use the unidecode module:

from unidecode import unidecode

print(unidecode('ǻ')) # a
2
  • Thank You, I was not sure this was possible Feb 17, 2018 at 23:51
  • If this answer solved your question, click the green outlined checkmark to the left of the answer, so people know it's solved.
    – Jeremiah
    Feb 18, 2018 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.