How to remove hebrew niqqud from a string in python?
Question:
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 “שלום”.
Answers:
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])
Simple:
s = re.sub('[u0591-u05C7]', '', s)
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 “שלום”.
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])
Simple:
s = re.sub('[u0591-u05C7]', '', s)