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

Function preprocess_text does not seem to strip punctuations #15

Open
govindgnair23 opened this issue Apr 15, 2019 · 0 comments
Open

Function preprocess_text does not seem to strip punctuations #15

govindgnair23 opened this issue Apr 15, 2019 · 0 comments

Comments

@govindgnair23
Copy link

govindgnair23 commented Apr 15, 2019

def preprocess_text(text):
    text = ' '.join(word.lower() for word in text.split(" "))
    text = re.sub(r"([.,!?])", r" \1 ", text)
    text = re.sub(r"[^a-zA-Z.,!?]+", r" ", text)
    return text

Calling preprocess_text('Are you a, boy or a girl?') returns:

''are you a , boy or a girl ? "

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

1 participant