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

Improve training tokenization #8

Open
shiffman opened this issue Oct 26, 2017 · 0 comments
Open

Improve training tokenization #8

shiffman opened this issue Oct 26, 2017 · 0 comments

Comments

@shiffman
Copy link
Owner

This results in a lot of junk, not accounting for apostrophes and other punctuation. It could probably be improved using nltk or just being more thoughtful?

text = open(path).read().lower().replace("\n", " ")

# Split into sentences (this could be improved! Using nltk?)
sentences = re.split("[.?!]", text);

# Split each sentence into words! (this could also be improved!)
final_sentences = []
for sentence in sentences:
    words = re.split("\W+", sentence)
    final_sentences.append(words)
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