Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to filter all the emojis? #133

Open
liutianling opened this issue Sep 15, 2020 · 1 comment
Open

how to filter all the emojis? #133

liutianling opened this issue Sep 15, 2020 · 1 comment

Comments

@liutianling
Copy link

The raw text is : Pour l’amour de dieux me laisser plus jamais sortir avec un roux boutonneux 🙏🏻
and the result is: Pour l’amour de dieux me laisser plus jamais sortir avec un roux boutonneux :folded_hands_light_skin_tone:

Whether i need a regex process to get the final result as follow ?
Pour l’amour de dieux me laisser plus jamais sortir avec un roux boutonneux

@Ekaterina-Sinkova
Copy link

@liutianling It's been a while but I decided to comment though

Actually you do not have to use the emoji library to filter emojis. You can do it using the following function to filter special unicode symbols:

def remove_emojis(text):
    emoji_pattern = re.compile("["
                               u"\U0001F600-\U0001F64F" 
                               u"\U0001F300-\U0001F5FF" 
                               u"\U0001F680-\U0001F6FF"
                               u"\U0001F1E0-\U0001F1FF"
                               "]+", flags=re.UNICODE)
    return emoji_pattern.sub(r'', text)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants