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

remove_punctuation() is not removing "\" #221

Open
batmanscode opened this issue Mar 19, 2022 · 2 comments
Open

remove_punctuation() is not removing "\" #221

batmanscode opened this issue Mar 19, 2022 · 2 comments

Comments

@batmanscode
Copy link

>>> import texthero as hero
>>> import pandas as pd
>>> import string
>>>
>>> s = pd.Series(rf"{string.punctuation}")
>>> hero.remove_punctuation(s)
0     \ 
dtype: object
@richecr
Copy link

richecr commented Apr 4, 2023

Hi, I could act on this question. Do you have any suggestions or can I start working from scratch?

A solution that could even improve the performance of the method:

import string

s = "dakmdalk\@....dada"

exclude = set(string.punctuation)
table = str.maketrans('', '', string.punctuation)
a = s.translate(table)

print(a)
# "dakmdalkdada"

@jbesomi
Copy link
Owner

jbesomi commented Apr 17, 2023

Hey, happy to receive your PR @richecr !

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

No branches or pull requests

3 participants