Created
June 12, 2019 22:06
-
-
Save nanotroy/b3b267b1d5615764db97df36fad930e8 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 process_text(text): | |
doc = nlp(text.lower()) | |
result = [] | |
for token in doc: | |
if token.text in nlp.Defaults.stop_words: | |
continue | |
if token.is_punct: | |
continue | |
if token.lemma_ == '-PRON-' | |
continue | |
result.append(token.lemma_) | |
return " ".join(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 9 needs a colon at the end.
[I got here via https://medium.com/better-programming/the-beginners-guide-to-similarity-matching-using-spacy-782fc2922f7c]