Package: twitterpersona
twitterpersonaTwitter 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 MaintainersRenzo WijngaardenRoan RainaAndy WangYurui FengQuick StartTo get started withtwitterpersona, install it usingpip:$pipinstalltwitterpersonaPlease visit thedocumentationfor more information and examples.''To get twitter developer account, please find follow instructions and apply one athttps://developer.twitter.com/enLog-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.)Click sign up at developer.twitter.com to enter your developer account name, location and use case detailsReview and accept the developer agreement and submitCheck your email to verify your developer account. Look for an email fromdeveloper-accounts@twitter.comthat has the subject line: "Verify your Twitter Developer Account" Note: thedeveloper-accounts@twitter.comemail is not available for inbound requests.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 Functionsload_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 tweetssentiment_analysis: determines the general (average) sentiment of recent tweetssentiment_labler(): returns all tweets with the corresponding labelspreprocessing: a spotter that identifies credit card numbersgeneralPreprocessing: returns the processed tweet dataframegenerate_word_cloud: a spotter that identifies credit card numberscreate_wordcloud: returns a matplotlib plot of the wordcloudBelow is a simple quick start example:fromtwitterpersonaimportload_twitter_msg,sentiment_analysis,preprocessing,generate_word_cloud# Create a cleanser, and don't add the default spottersuser=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-mnltk.downloadervader_lexiconScope and FitThere are existing packages that preform tweet analysis (includingtwitter-sentiment-analysis,tweetlytics, andpytweet). However, none of these packages focus of providing metrics in the context of determining if the twitter user is worth engaging with.ContributingInterested 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.Licensetwitterpersonawas created by Andy Wang, Renzo Wijngaarden, Roan Raina, Yurui Feng. It is licensed under the terms of the MIT license.Creditstwitterpersonawas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.