Algorithmically predict public sentiment on a topic using VADER sentiment analysis
Project description
abraham
Algorithmically predict public sentiment on a topic using VADER sentiment analysis.
Sample Output
You can run one command to do everything -
from prophets import Isaiah
darthvader = Isaiah(news_source="google", splitting=True) # splitting means that it recursively splits a large text into sentences and analyzes each individually
# this command takes a bit of time to run because it has to download lots of articles
scores = darthvader.sentiment(["robinhood",
"johnson and johnson",
"bitcoin",
"dogecoin",
"biden",
"amazon"],
window=2, # how many days back from up_to to get news from
up_to="04/18/2021") # latest date to get news from
print(scores)
'''
{'robinhood':
{
'avg': 0.3798676562301132,
'nice': 'positive :)'
},
'johnson and johnson':
{
'avg': 0.27466788299009787,
'nice': 'positive :)'
},
'bitcoin':
{
'avg': 0.28669931035859125,
'nice': 'positive :)'
},
'dogecoin':
{
'avg': 0.2837840361036227,
'nice': 'positive :)'
},
'biden':
{
'avg': 0.2404157345348728,
'nice': 'positive :)'
},
'amazon':
{
'avg': 0.2894022880254384,
'nice': 'positive :)'
}
}
'''
Or, you can run it step by step, as well.
from prophets import Isaiah
darthvader = Isaiah(news_source="google", splitting=True) # splitting means that it recursively splits a large text into sentences and analyzes each individually
# this command takes a bit of time to run because it has to download lots of articles
articles = darthvader.get_articles(["robinhood",
"johnson and johnson",
"bitcoin",
"dogecoin",
"biden",
"amazon"]
window=2, # how many days back from up_to to get news from
up_to="04/18/2021") # latest date to get news from
scores = darthvader.score_all(articles)
print(scores)
'''
{'robinhood':
{
'avg': 0.3798676562301132,
'nice': 'positive :)'
},
'johnson and johnson':
{
'avg': 0.27466788299009787,
'nice': 'positive :)'
},
'bitcoin':
{
'avg': 0.28669931035859125,
'nice': 'positive :)'
},
'dogecoin':
{
'avg': 0.2837840361036227,
'nice': 'positive :)'
},
'biden':
{
'avg': 0.2404157345348728,
'nice': 'positive :)'
},
'amazon':
{
'avg': 0.2894022880254384,
'nice': 'positive :)'
}
}
'''
Isaiah
supports two news sources: [Google News](google news) and NewsAPI. Default is [Google News](google news), but you can change it to NewsAPI by passing Isaiah(news_source='newsapi')
when instantiating. In order to use NewsAPI, you have to put your api key in keys/newsapi_org
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
abraham3k-1.0.1.tar.gz
(2.3 kB
view details)
Built Distribution
File details
Details for the file abraham3k-1.0.1.tar.gz
.
File metadata
- Download URL: abraham3k-1.0.1.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fea05959b32829e5041176c7a6287775975c1fb6ef7c73c95928c427544babf |
|
MD5 | 75f46cb897c21ba4bf7a8925f796de5e |
|
BLAKE2b-256 | 575622d726625ed625c429213ee0e6dd2291e48e07be6de68798f0ab31979162 |
File details
Details for the file abraham3k-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: abraham3k-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/3.10.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e41486dfddca36f0adb9e5b1a71d93d34961f6b79d4e697dd3c240cc5e2623a9 |
|
MD5 | c9994738274bc7e2b305194cb0c5c15f |
|
BLAKE2b-256 | b9758b75d641d552953024ca20c265987613d9eda6c1c682dc38486b5bd323ab |