Assess whether a twitter is positive or negative based on the user's recent tweets
Project description
twitterpersona
Twitter is a popular social media app with over 1 billion user accounts. While a diversity of users is a strength, some individuals have concerns with the prevalence of "troll" accounts and individuals who exhibit unconstructive tone and diction whom they deem not worth engaging with. The package twitterpersona is intended to provide insight into a twitter user based on their tweet history in effort to determine if an account is worth engaging with. The package provides an easy to use interface for determining the general sentiment expressed by a user.
Contributors and Maintainers
Quick Start
To get started with twitterpersona, install it using pip:
$ pip install twitterpersona
Please visit the documentation for more information and examples.
Classes and Functions
load_twitter_msg: returns a user's recent tweets (as a dataframe) given theiruser idusing the Twitter API.user_info(): get user credentials detailsload_twitter_by_user(): load specific user's tweetsload_twitter_by_keywords(): load specific keyword's tweets
sentiment_analysis: determines the general (average) sentiment of recent tweetssentiment_labler(): returns all tweets with the corresponding labels
preprocessing: a spotter that identifies credit card numbersgeneralPreprocessing: returns the processed tweet dataframe
generate_word_cloud: a spotter that identifies credit card numberscreate_wordcloud: returns a matplotlib plot of the wordcloud
Below is a simple quick start example:
from twitterpersona import load_twitter_msg, sentiment_analysis, preprocessing, generate_word_cloud
# Create a cleanser, and don't add the default spotters
user = user_info('consumer key', 'consumer secret', 'access_token', 'token_secret')
twitter_df = load_twitter_by_user('someuser', 30, user)
sentiment_df = sentiment_labler(twitter_df, 'text')
cleaned_df = generalPreprocessing(sentiment_df)
plt = generate_word_cloud(cleaned_df)
In order to run test, you need to first install the vader_lexicon package
$ python -m nltk.downloader vader_lexicon
Scope and Fit
There are existing packages that preform tweet analysis (including twitter-sentiment-analysis, tweetlytics, and pytweet). However, none of these packages focus of providing metrics in the context of determining if the twitter user is worth engaging with.
Contributing
Interested in contributing? Check out the contributing guidelines in CONTRIBUTING.md. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.
License
twitterpersona was created by Andy Wang, Renzo Wijngaarden, Roan Raina, Yurui Feng. It is licensed under the terms of the MIT license.
Credits
twitterpersona was created with cookiecutter and the py-pkgs-cookiecutter template.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file twitterpersona-0.3.1.tar.gz.
File metadata
- Download URL: twitterpersona-0.3.1.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
137c288532efc6d9a74043d2ea4d84b984269f3082bbb6b6fded7d98a48b0423
|
|
| MD5 |
13d853866cbf59fb2c79a8e8fe2e533b
|
|
| BLAKE2b-256 |
4e9cf7708bc1bc5229000bd111214b762c8d84eed6ff4ef525de47f61e8bd7be
|
File details
Details for the file twitterpersona-0.3.1-py3-none-any.whl.
File metadata
- Download URL: twitterpersona-0.3.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
457ba4f6a7db577c3582375562b03e1ab66ad99301f1d9235d416e0d473beec5
|
|
| MD5 |
c244066eaf56cea1231c0ac21d5ca005
|
|
| BLAKE2b-256 |
b83597f14f7929d07c4833aa79018d3a6ca1dd0c56a5109cbed93f7d7dd6bf6b
|