Skip to main content

Assess whether a twitter is positive or negative based on the user's recent tweets

Project description

ci-cd Documentation Status PyPI License: MIT

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.''

To get twitter developer account, please find follow instructions and apply one at https://developer.twitter.com/en

  1. Log-in to Twitter and verify your email address. (Note that the email and phone number verification from your Twitter account may be needed to apply for a developer account, review on the Twitter help center: email address confirmation or add phone number.)
  2. Click sign up at developer.twitter.com to enter your developer account name, location and use case details
  3. Review and accept the developer agreement and submit
  4. Check your email to verify your developer account. Look for an email from developer-accounts@twitter.com that has the subject line: "Verify your Twitter Developer Account" Note: the developer-accounts@twitter.com email is not available for inbound requests.
  5. You should now have access to the Developer Portal to create a new App and Project with Essential access, or will need to continue your application with Elevated access If you apply for Elevated access (or Academic Research access) please continue to check your verified email for information about your application.

Classes and Functions

  1. load_twitter_msg: returns a user's recent tweets (as a dataframe) given their user id using the Twitter API.
    1. user_info(): get user credentials details
    2. load_twitter_by_user(): load specific user's tweets
    3. load_twitter_by_keywords(): load specific keyword's tweets
  2. sentiment_analysis: determines the general (average) sentiment of recent tweets
    1. sentiment_labler(): returns all tweets with the corresponding labels
  3. preprocessing: a spotter that identifies credit card numbers
    1. generalPreprocessing: returns the processed tweet dataframe
  4. generate_word_cloud: a spotter that identifies credit card numbers
    1. create_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

twitterpersona-0.3.8.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

twitterpersona-0.3.8-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file twitterpersona-0.3.8.tar.gz.

File metadata

  • Download URL: twitterpersona-0.3.8.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for twitterpersona-0.3.8.tar.gz
Algorithm Hash digest
SHA256 9a4f4ae336ea86992744fb1eccd1acbf5bca32ab56c1f5cfa436107b48d284ef
MD5 e533b399cceb5eded3141075bf02890c
BLAKE2b-256 bed7834bb336a6b394e9ce9388d77c78d5e40b9ac49a72721a061b207b9db3b6

See more details on using hashes here.

File details

Details for the file twitterpersona-0.3.8-py3-none-any.whl.

File metadata

  • Download URL: twitterpersona-0.3.8-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.1

File hashes

Hashes for twitterpersona-0.3.8-py3-none-any.whl
Algorithm Hash digest
SHA256 051fec0f8be07940a47b34d0f061ef58b5691ea41b278c8397e093f0f3d20751
MD5 76591e78b0bc4ba709779f43bd168b19
BLAKE2b-256 5f8e4e0903d85e0767ae86aae82c3a77e36335e0b8969bf6db0e9a2334a511c5

See more details on using hashes here.

Supported by

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