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

question about clearn_str in process_data.py #42

Open
zhililab opened this issue Mar 8, 2018 · 1 comment
Open

question about clearn_str in process_data.py #42

zhililab opened this issue Mar 8, 2018 · 1 comment

Comments

@zhililab
Copy link

zhililab commented Mar 8, 2018

Hi @yoonkim Recently, I am reading dennybritz/cnn-text-classification-tf implementation based on your original code I found there some regrex pattern in the function clean_str(string)such as

    string = re.sub(r"\'d", " \'d", string)
    string = re.sub(r"\'ll", " \'ll", string)
    string = re.sub(r",", " , ", string)
    string = re.sub(r"!", " ! ", string)
    string = re.sub(r"\(", " \( ", string)

when program find this kind of patterns, it just replaces found pattern with the same thing from my viewpoint.
So my question is that whats the purpose of those re.sub code. Im confused. Could u give me some clues? Thx a lot ; )

@rzsgrt
Copy link

rzsgrt commented Dec 3, 2019

for first line string = re.sub(r"\'d", " \'d", string)
it will separate word i'd to i 'd

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

2 participants