remove_arabic_punctuations

PHOTO EMBED

Sun Dec 25 2022 15:54:09 GMT+0000 (Coordinated Universal Time)

Saved by @abdalrahmansh #python #kaggle #nlp #arabicnlp #unicode

ARABIC_PUNCTUATION = ':"؟!؛،,.؍, '

def remove_arabic_punctuations(text : str) -> str:
    '''
        text : ", أَهْلًا وسَهْلًا Hello 212"
        output : 
            ---> "  أَهْلًا وسَهْلًا Hello 212"
    '''
    chars = [char for char in text if (char not in ARABIC_PUNCTUATION)]
    output = ''.join(chars)
    return output
content_copyCOPY