Last active
June 2, 2020 22:31
-
-
Save oaguy1/d11aa812b095e300515234072521cfb4 to your computer and use it in GitHub Desktop.
Removing stop words from a raw natrual language text
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
nlp = spacy.load('en_core_web_sm') | |
# comments is an array of strings we generated earlier | |
parsed_bodies = [nlp(comm) for comm in comments] | |
cleaned = [] | |
for doc in parsed_bodies: | |
current = [] | |
for token in doc: | |
if not token.is_stop: | |
current.append(token.text) | |
cleaned.append(current) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment