Skip to main content

Algorithmically predict public sentiment on a topic using VADER sentiment analysis

Project description

abraham

PyPI version

Algorithmically predict public sentiment on a topic using VADER sentiment analysis.

Installation

Installation is simple; just install via pip.

$ pip3 install abraham3k

Sample Output

You can run one command to do everything -

from prophets import Isaiah

# splitting means that it recursively splits a large text into sentences and analyzes each individually
darthvader = Isaiah(news_source="google", splitting=True) 

# 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

# splitting means that it recursively splits a large text into sentences and analyzes each individually
darthvader = Isaiah(news_source="google", splitting=True)

# 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', api_key='<your api key') when instantiating.

Updates

I've made it pretty simple (at least for me) to push updates. Once I'm in the directory, I can run $ ./build-push 1.2.0 "update install requirements" where 1.2.0 is the version and "update install requirements" is the git commit message. It will update to PyPi and to the github repository.

Project details


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.2.0.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

abraham3k-1.2.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file abraham3k-1.2.0.tar.gz.

File metadata

  • Download URL: abraham3k-1.2.0.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • 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.58.0 CPython/3.9.2

File hashes

Hashes for abraham3k-1.2.0.tar.gz
Algorithm Hash digest
SHA256 cb362d4b8c225322d50e059e0da95bf37db23f7a25814371615874fda67b8081
MD5 fe5e246e90f31e6397a3c85a542e7502
BLAKE2b-256 39edef2163931867880dabf1d8778593c29c95c26cae755e2f0ccda42bff3182

See more details on using hashes here.

File details

Details for the file abraham3k-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: abraham3k-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 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.58.0 CPython/3.9.2

File hashes

Hashes for abraham3k-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8bd23163468a4cc180605ce69135415381f0cc283610ecccbabea214be7a5014
MD5 a29109f7fab66b7ed98d62c4c9632b9b
BLAKE2b-256 144635a369bab6c34b2bde7aae9f1f44db5a37ee9b89a04b844416634ecb003b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page