Skip to content

Instantly share code, notes, and snippets.

@ferrygun
Created June 8, 2020 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ferrygun/7229d5b9aea763d2503c8945f119178f to your computer and use it in GitHub Desktop.
Save ferrygun/7229d5b9aea763d2503c8945f119178f to your computer and use it in GitHub Desktop.
articles = []
labels = []
with open("/tmp/bbc-text.csv", 'r') as csvfile:
reader = csv.reader(csvfile, delimiter=',')
next(reader)
for row in reader:
labels.append(row[0])
article = row[1]
for word in STOPWORDS:
token = ' ' + word + ' '
article = article.replace(token, ' ')
article = article.replace(' ', ' ')
articles.append(article)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment