Search code examples
pythonstringnlpnormalizationhebrew

How to remove hebrew niqqud from a string in python?


given a string s, I want a method to return a string s' which contains all of the chars in s except the ones which are hebrew niqqud. for example: "שָׁלוֹם" will become "שלום".


Solution

  • this method can work:

    def remove_niqqud_from_string(my_string):
        return ''.join(['' if  1456 <= ord(c) <= 1479 else c for c in my_string])