Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# TextMining

This is the base repo for the text mining and analysis project for Software Design at Olin College.

Changed Readme so that I can have a release branch.
Accidently committed to master, so please excuse me for that.
Binary file added bbc.pickle
Binary file not shown.
Binary file added cnn.pickle
Binary file not shown.
28 changes: 28 additions & 0 deletions dataAnalysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pickle
from bs4 import BeautifulSoup
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer

def analyzer(filename):
input_file = open(filename, 'rb')
websitee = pickle.load(input_file)

soup = BeautifulSoup(websitee, "html.parser")

text = soup.get_text()
count = 0
newtext = text.split()
for i in newtext:
if(i == "trump" or i == "Trump"):
count += 1
analyze = SentimentIntensityAnalyzer()
scores = analyze.polarity_scores(text)
return count, scores


if __name__ == "__main__":
websites = ['bbc.pickle', 'cnn.pickle', 'foxnews.pickle']
for i in websites:
count = analyzer(i)[0]
scores = analyzer(i)[1]
print("Number of times Trump is mentioned: " , count)
print("Positivity/Negativity score: ", scores)
Binary file added foxnews.pickle
Binary file not shown.
Binary file added sodezz.pdf
Binary file not shown.
7 changes: 7 additions & 0 deletions textmining.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import requests
import pickle
website = 'http://cnn.com'
sampleText = requests.get(website).text
f = open('cnn.pickle', 'wb')
pickle.dump(sampleText, f)
f.close()