Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
marixko committed Oct 20, 2022
1 parent 6508568 commit d75f911
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from wordcloud import WordCloud
import matplotlib.pyplot as plt

nltk.download("stopwords")

def get_top_ngram(corpus, n=None):
vec = CountVectorizer(ngram_range=(n, n)).fit(corpus)
bag_of_words = vec.transform(corpus)
Expand All @@ -26,6 +28,7 @@ def tokenize(s):
return word_tokenize(s, language="english")

def remove_stopwords(s):
stpwrds = set(stopwords.words("english"))
return [w for w in s if not w in stpwrds]

def stem(s):
Expand Down

0 comments on commit d75f911

Please sign in to comment.