Created
April 23, 2021 05:05
-
-
Save tejas-kr/836796fd18470f84650af95d950a2048 to your computer and use it in GitHub Desktop.
text processing for nlp tasks (using nltk) [for spacy i will create soon]
This file contains hidden or 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
from nltk.corpus import stopwords | |
import string | |
def text_process(text): | |
nopunc = [char for char in text if char not in string.punctuation] | |
nopunc = ''.join(nopunc) | |
return [word for word in nopunc.split() if word.lower() not in stopwords.words('english')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment