Created
June 29, 2018 18:42
-
-
Save himlohiya/cf99ed03a1ba72f068aa8abcea27c8fb to your computer and use it in GitHub Desktop.
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
def simple_stemmer(text): | |
ps = nltk.porter.PorterStemmer() | |
text = ' '.join([ps.stem(word) for word in text.split()]) | |
return text | |
def lemmatize_text(text): | |
text = nlp(text) | |
text = ' '.join([word.lemma_ if word.lemma_ != '-PRON-' else word.text for word in text]) | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment