Saravanan666/pypi-org huggingface dataset:
Package: tweet-generator
Tweet GeneratorThe tweet generator uses a Markov chain finite state model to take a
particular user id from twitter and generate tweets based off of that person’s
previous tweets. The tweets are stored in a JSON document which allows for random
walks of the tweets to occur.GoalsSimplify creating a basic Markov Chain Twitter Bot.Easy to read and provide an introduction to a simple way to create something intelligent!FeaturesOption to remove urls.Option for proper capitalizationOutput of the generated tree into a pretty JSON Format that you can review.Scraping of the Twitter API using the Tweepy LibraryInstallationTo install, use pippip install tweet-generatorExampleSee the following example:from tweet_generator import tweet_generator
TPCK = '<public_consumer_key>'
TSCK = '<secret_consumer_key>'
TPAK = '<public_access_key>'
TSAK = '<secret_access_key>'
twitter_bot = tweet_generator.PersonTweeter('25073877',TPCK,TSCK,TPAK,TSAK)
random_tweet = twitter_bot.generate_random_tweet()
print(random_tweet)
Package: tweet-getter
This application creates the dataset through fetching tweets by their IDs.There are some policies to avoid tweets content directly. Thus, there are many datasets with just tweets IDs and their labels. Hence, I’ve prepared an application to fetch these tweets context by their IDs using Twitter API. Consequently, you need a Twitter API Token <http://apps.twitter.com>.In./datasetdirectory exists a dataset contains 1.3 million tweets in seven categories label (anger,thankfulness,joy,sadness,fear,love,surprise) by their IDs.Installationpip install -r requirements.txtConfigurationCustomize the configuration file (./configuration/configs.py)Runpython-mtweet_getter.dataset_maker<start-row-optional><end-row-optional>[NOTE]:This package is compatible onPython 3
Package: tweet-images
tweet-imagesSend tweets with images from the command lineInstallationInstall this tool usingpip:pip install tweet-imagesExampleThis tool is used by the@covidsewagebot on Twitter, seesimonw/covidsewage-botandBuilding a Covid sewage Twitter bot.UsageYou'll need a consumer key, consumer secret, access token key and access token secret for a Twitter account that you wish to tweet from. SeeHow to get credentials for a new Twitter botfor tips on obtaining these.You can pass those as the--consumer-key,--consumer-secret,--access-token-key,--access-token-secretoptions to the command, or you can set them as environment variables like this:export TWITTER_CONSUMER_KEY="..."
export TWITTER_CONSUMER_SECRET="..."
export TWITTER_ACCESS_TOKEN_KEY="..."
export TWITTER_ACCESS_TOKEN_SECRET=".."You can then send a tweet like this:tweet-images "This is my tweet"Or attach between one and four images to that tweet by passing their file paths:tweet-images "Three pictures attached" one.jpg two.jpg three.jpgYou can pass--alt "alt text"one or more times to attach alt text to your images:tweet-images "Three pictures attached" one.jpg two.jpg \
  --alt "Alt text for one" --alt "Alt text for two"Using this with GitHub ActionsHere's an example fragment froma GitHub Actions workflowthat uses this tool. The repository has four repository secrets configured with the necessary credentials, and a previous step has already installed thetweet-imagesPython package:-name:Tweet the new imageenv:TWITTER_CONSUMER_KEY:${{ secrets.TWITTER_CONSUMER_KEY }}TWITTER_CONSUMER_SECRET:${{ secrets.TWITTER_CONSUMER_SECRET }}TWITTER_ACCESS_TOKEN_KEY:${{ secrets.TWITTER_ACCESS_TOKEN_KEY }}TWITTER_ACCESS_TOKEN_SECRET:${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}run:|-tweet-images "Latest Covid sewage charts for the SF Bay Area" \/tmp/covid.png --alt "Screenshot of the charts"DevelopmentTo contribute to this tool, first checkout the code. Then create a new virtual environment:cd tweet-images
python -m venv venv
source venv/bin/activateNow install the dependencies and test dependencies:pip install -e '.[test]'To run the tests:pytest
Package: tweetkit
# [TweetKit](https://github.com/ysenarath/tweetkit)[![Documentation Status](https://readthedocs.org/projects/tweetkit/badge/?version=latest)](https://tweetkit.readthedocs.io/en/latest/?badge=latest)
[![PyPI version](https://badge.fury.io/py/tweetkit.svg)](https://badge.fury.io/py/tweetkit)A python Twitter client focused mainly on Twitter API for academic research.InstallationIf you have pip installed:pip install tweetkitFrom the source:`shell git clonehttps://github.com/ysenarath/tweetkit.git# add path to the ./tweetkit folder in PYTHONPATH exportPYTHONPATH="${PYTHONPATH}:$(pwd)/tweetkit"`
Package: tweetle
TweetleA python based CLI to control your twitter account and get analytical dataInstallationThrough pipFor windows:pip install tweetleFor linux/macos:pip3 install tweetleManual Installationgit clone https://github.com/4RCAN3/Tweetle/setup.batvenv\scripts\activatetweetleCommands:Languages usedContributeAny contributions you make aregreatly appreciated.PRs are accepted!!If you have some ideas for new features and you don't have time to implement them please open an issue with the tag new_feature.Please don't forget to comment (document) your code!
Package: tweetlib
Twitter ScraperA python twitter scraper with no-api keys required.Installationpip3 install tweetlibHow to use itAll these parameters can be used in combination with one another.ts = tweetlib.TweetLib(username="barackobama", max_tweets=10)Argumentsusername(str): any valid twitter name you want to scrapesince("yyyy-mm-dd"): A lower bound date to restrict search.until("yyyy-mm-dd"):An upper bound date to restrict search.query_search(str): Search stringmax_tweets(int): Max number of tweets you want to scrape.Examplesfromtweetlibimporttweetlib# Get tweets by usernamets=tweetlib.TweetLib(username="barackobama",max_tweets=10)tweets=ts.get_tweets()# Search for tweetsts=tweetlib.TweetLib(query_search="college",since="2018-01-01")tweets=ts.get_tweets()Tweet ObjectThe tweet objects it returns in the list contain the following:tweet = {
    id (str)
    permalink (str)
    username (str)
    text (str)
    date (date)
    replies (int)
    retweets (int)
    favorites (int)
    mentions (str)
    hashtags (str)
}Credit and ContactCreated by Wyatt FergusonFor any comments or questions your can reach me on Twitter@wyattfergusonor visit my little portfolio atwyattf.dev
Package: tweetlimiter
tweetlimiterPackage to estimate the rate of a message stream and to limit the number of
message.QuickstartInstall the package using pip$pipinstalltweetlimiterUsage:importtweetlimiterastllimiter=tl.Limiter(target=1,damp_rate=0.1)formsginstream():# loop over messagesdecision=limiter.filter(msg.time,msg.followers)ifdecision:pass# processLinksGitLab Repositorytweetlimiter on PyPi
Package: tweetlytics
tweetlyticsThis package would retrieve tweets on a required topic and time frame, stores them, performs data cleaning, data analysis, and plotting.InstallationpipinstalltweetlyticsFeaturesThe package tweetytics is a package intended to give insight about a topic on Tweeter through some functions. The intention is that a user with little knowledge about data science can quickly call a function to analyze how the topics and trends are on Twitter. Internally, the package uses the official twitter API, stores the data as a .json and .csv file, performs data cleaning, data analysis and plotting.There are four main functions planned for development and they are outlined below.  Additional functions may be added if time permits.Function 1: get_storeUtilizes the official Twitter API to collect data based on a keyword, date range and number of results the user requires. The data is then stored as a .Json file and a .csv file(optional). The function will also give the user the option to return a pandas data frame based on the stored files.Function 2: clean_tweetsTakes the created pandas data frame from the get_store() function and clean the data frame based on the required_cols, keep_punctuation, only_words… arguments entered by the user.Function 3: analyticsTakes the tidy data frame from the clean() function and returns an analysis dict report including mean_word_count, most used words, mean_likes, most_used_hashtags, word_hashtag_ratio …Function 4: plot_tweetsTaking both the cleaned data frame from the clean() function and the returned dict from the perform_analysis() function, a range of plots such as likes_wordcount, likes_hashtags… will be generated and saved as files.Note•As working with the Twitter API requires a personal ‘bearer token’ a user can create their own token and add it as a parameter to the get_store() function.
•The package also include an example .Json and .csv file  based on the keyword ‘omicron’.Dependencies• requests
• pandas
• dotenv
• altair
• numpy
• textblob
• string
• matplotlib
• wordcloudUsage•To use to get_store() function, users will require to obtain a bearer token for the official Twitter API V2. The bearer token can be requested on developers.twitter.com.
•To test the package output, we have added sample files returned from the get_store() function and users can run clean_tweets(), analytics() and the plot_freq() functions.Sample outputs• analytics()• plot_freq()Dashboard sample images - Twitter Analytics Dashboard created with React JS and Material UI, using the output JSON files from tweetlytics.DocumentationThe official documentation is hosted onRead the docsContributingIWe welcome and recognize all contributions. You can see a list of current contributors in thecontributors tab.Amir Shojakhani: @amirshojaShiva Shankar Jena: @shivajenaMahmood Rahman: @mahm00d27Mahsa Sarafrazi: @mahsasarafraziLicensetweetlyticswas created by group of students in UBC MDS program. It is licensed under the terms of the MIT license.Creditstweetlyticswas created withcookiecutterand thepy-pkgs-cookiecuttertemplate.
Package: tweetmagick
Generate images with tweet-like appearanceInstallationpip3 install tweetmagickExamplesDisplaying the image and quitting without saving it can be done like so:fromtweetmagickimportTweetGeneratorname="harold"longname="stockmaster"avatar="harold.jpg"text="feeling pompous today, might delete later"withTweetGenerator(name,longname,avatar,text)astg:tg.tweetgen(debug=True)tweetgenmethod returns BytesIO object with png binary blob.
Below is the code that will save your image to a file:fromshutilimportcopyfileobjwithTweetGenerator(name,longname,avatar,text,theme="light")astg:withopen("haroldtweets.png","wb")astweet:copyfileobj(tg.tweetgen(),tweet)Results in :Withdarktheme option:TODOImplement some streamlined method for embedding images in tweets.Also some method for reply/quote images
Package: tweetopic
tweetopicBlazing Fast Topic modelling for Short Texts:zap: Blazing Fast topic modelling over short texts utilizing the power of :1234: Numpy and :snake: Numba.FeaturesFast :zap:Scalable :collision:High consistency and coherence :dart:High quality topics :fire:Easy visualization and inspection :eyes:Full scikit-learn compatibility :nut_and_bolt:🛠 InstallationInstall from PyPI:pipinstalltweetopic👩‍💻 Usage (documentation)Train your a topic model on a corpus of short texts:fromtweetopicimportDMMfromsklearn.feature_extraction.textimportCountVectorizerfromsklearn.pipelineimportPipeline# Creating a vectorizer for extracting document-term matrix from the# text corpus.vectorizer=CountVectorizer(min_df=15,max_df=0.1)# Creating a Dirichlet Multinomial Mixture Model with 30 componentsdmm=DMM(n_components=30,n_iterations=100,alpha=0.1,beta=0.1)# Creating topic pipelinepipeline=Pipeline([("vectorizer",vectorizer),("dmm",dmm),])You may fit the model with a stream of short texts:pipeline.fit(texts)To investigate internal structure of topics and their relations to words and indicidual documents we recommend usingtopicwizard.Install it from PyPI:pipinstalltopic-wizardThen visualize your topic model:importtopicwizardtopicwizard.visualize(pipeline=pipeline,corpus=texts)🎓 ReferencesYin, J., & Wang, J. (2014). A Dirichlet Multinomial Mixture Model-Based Approach for Short Text Clustering.In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining (pp. 233–242). Association for Computing Machinery.
Package: tweetple
TWEETPLEInstallationThe easiest way to install the latest version from PyPI is by using pip:pipinstalltweetpleUsageUsers and Followers LookupimporttweetplefromtweetpleimportTweetPle# Bearer token accesible via Twitter Developer Academic Research Trackbearer_token='AAAAAAAA'# List of idsids=['308131814']# Retrieve users' informationTweetPle.TweepleStreamer(ids,bearer_token).user_lookup()# Retrieve followers' informationTweetPle.TweepleStreamer(ids,bearer_token).followers_lookup()Retrieve TweetsOne can provide as input alistof:Tweets' idsTweeples' handlesLinksimporttweetplefromtweetpleimportTweetPle# bearer token accesible via Twitter Developer Academic Research Trackbearer_token='AAAAAAAA'# list of tweets' idstweetl=['1461090445702881281']TweetPle.TweetStreamer(tweetl,bearer_token).main()# list of tweeplers' handlestweeplel=['zorroyanez']TweetPle.TweetStreamer(tweeplel,bearer_token).main()# list of links potentially shared via twitterlinkl=['https://lula.com.br/22-vitorias-judiciais-de-lula-inquerito-contra-filhos-e-encerrado-por-falta-de-provas/']TweetPle.TweetStreamer(linkl,bearer_token).main()
Package: tweetprep
# tweetprepA simple python library for preprocessing tweets to make them training
ready. Use it to preprocess the tweets before feeding them to Machine
Learning or Deep Learning models.The code is Python 2 and 3 compatible.# InstallationFast install:pip install tweetprepFor a manual install get this package:$wgethttps://github.com/garain/tweetprep/archive/master.zip$unzipmaster.zip$rmmaster.zip$cdtweetprep-masterInstall the package:python setup.py install# Examplefromtweetprepimportpreprocess#from tweetprep import lang_translatortweet="#COVID-19 is the worst pandemic @2020!! :,("# get translated tweetlang="es"print(preprocess.lang_translator.translate(tweet,dest=lang).text)# Get processed version of tweetprint(preprocess.clean(tweet))Here is the output:# COVID-19 es la peor pandemia @ 2020!! :,(
covid19 is the worst pandemic crying smileyPlease cite these publications if this library comes to any use:Ray, Biswarup, Avishek Garain, and Ram Sarkar. “An ensemble-based hotel recommender system using sentiment analysis and aspect categorization of hotel reviews.” Applied Soft Computing 98 (2021): 106935.Garain, Avishek, and Sainik Kumar Mahata. “Sentiment Analysis at SEPLN (TASS)-2019: Sentiment Analysis at Tweet Level Using Deep Learning.” (2019).Garain, Avishek, and Arpan Basu. “The titans at SemEval-2019 task 5: Detection of hate speech against immigrants and women in twitter.” Proceedings of the 13th International Workshop on Semantic Evaluation. 2019.Garain, Avishek. “Humor Analysis based on Human Annotation (HAHA)-2019: Humor Analysis at Tweet Level using Deep Learning.” (2019).Garain, Avishek, and Arpan Basu. “The titans at SemEval-2019 task 6: Offensive language identification, categorization and target identification.” Proceedings of the 13th International Workshop on Semantic Evaluation. 2019.
Package: tweet-preprocesser
tweet preprocessertweet preprocesser (remove hashtag, mention and url)pypi modulehttps://pypi.org/project/tweet-preprocesser/install$ pip install tweet-preprocesserusagefromtweet_preprocesserimportpreprocesserprint(preprocesser.removeHashtag("hogehoge #huga"))# " hogehoge"print(preprocesser.removeUrl("hogehoge http://example.com/?user=1#hoge https://example.com/?user=1#hoge"))# "hogehoge  "print(preprocesser.removeMention("@taro hello"))# " hello"
Package: tweetprocessor
TextPreprocessorOverviewThe TextPreprocessor is a Python class designed for comprehensive text preprocessing. It facilitates tasks like removing links, hashtags, special characters, emojis, numbers, and stopwords. Additionally, it provides functionality for converting text to lowercase.InstallationEnsure you have NLTK installed. You can install NLTK via pip:pip install nltkUsage### Import the TextPreprocessor classfromtext_preprocessorimportTextPreprocessor# Initialize the preprocessor with default settingspreprocessor=TextPreprocessor()# Customize the preprocessor by setting flagspreprocessor=TextPreprocessor(remove_links=True,remove_hashtags=True,remove_characters=True,convert_to_lowercase=True,remove_emojis=True,remove_numbers=True,remove_stopwords_flag=True)text="Your text goes here..."processed_text=preprocessor.preprocess_text(text)Available Methodspreprocess_text(text): Preprocesses the input text based on the initialized flags.Other methods in the class can be used individually for specific preprocessing steps (e.g., remove_links, remove_stopwords, etc.).Examplestext="Hello! This is an example text with #hashtags and links: https://example.com"# Initialize preprocessorpreprocessor=TextPreprocessor(remove_links=True,remove_hashtags=True)# Preprocess textprocessed_text=preprocessor.preprocess_text(text)print(processed_text)Output:"Hello This is an example text with and links"LicenseThis project is licensed under the MIT License - see the LICENSE file for details.
Package: tweetprocessor-1
TextPreprocessorOverviewThe TextPreprocessor is a Python class designed for comprehensive text preprocessing. It facilitates tasks like removing links, hashtags, special characters, emojis, numbers, and stopwords. Additionally, it provides functionality for converting text to lowercase.InstallationEnsure you have NLTK installed. You can install NLTK via pip:pip install nltkUsage### Import the TextPreprocessor classfromtext_preprocessorimportTextPreprocessor# Initialize the preprocessor with default settingspreprocessor=TextPreprocessor()# Customize the preprocessor by setting flagspreprocessor=TextPreprocessor(remove_links=True,remove_hashtags=True,remove_characters=True,convert_to_lowercase=True,remove_emojis=True,remove_numbers=True,remove_stopwords_flag=True)text="Your text goes here..."processed_text=preprocessor.preprocess_text(text)Available Methodspreprocess_text(text): Preprocesses the input text based on the initialized flags.Other methods in the class can be used individually for specific preprocessing steps (e.g., remove_links, remove_stopwords, etc.).Examplestext="Hello! This is an example text with #hashtags and links: https://example.com"# Initialize preprocessorpreprocessor=TextPreprocessor(remove_links=True,remove_hashtags=True)# Preprocess textprocessed_text=preprocessor.preprocess_text(text)print(processed_text)Output:"Hello This is an example text with and links"LicenseThis project is licensed under the MIT License - see the LICENSE file for details.
Package: tweetpy
tweetpyPython package which to access the Tweet data without APIInstallationThe easiest way to install the latest version from PyPI is by using pip:pip install tweetpyUsageDownload it by clicking the green download button here on Github. You only need to parse argument specific Twitter keyword.>>>fromtweetpy.tweetimportTweet>>>tweet=Tweet(1567531687130632199)DocumentationATTRIBUTEDESCRIPTIONVALUEEXAMPLEtextget tweet textString"Welcome to the home"conversation_countget conversation tweets countInteger0langget tweet language codeString"en"favorite_countget likes countInteger195created_atget when the tweet createddatetime.datetimedatetime.datetime(2018, 8, 3, 2, 22, 56)idget tweet idInteger1025205344660856838id_strget tweet id as stringString'1025205344660856838'possibly_sensitiveis tweet has sensitive contentBooleanFalse
Package: tweetpy-janmarkuslanger
tweetpyCreate your own bot without the api.Use at your own risk!Installpip install tweetpy-janmarkuslangerExampleimporttimefromtweetpyimportTwitterhashtags=('development','software','selenium','python')whileTrue:withTwitter(username='myusername',password='mypassword')asbot:bot.login()forhashtaginhashtags:bot.retweet_by_tag(hashtag,max=10)# retweets the newest hashtagstime.sleep(3600)# sleep for an hour
Package: tweetpy-janmarkuslanger-test
tweetpyCreate your own bot without the api.Use at your own risk!Installpip install tweetpy-janmarkuslangerExampleimporttimefromtweetpyimportTwitterhashtags=('development','software','selenium','python')whileTrue:withTwitter(username='myusername',password='mypassword')asbot:bot.login()forhashtaginhashtags:bot.retweet_by_tag(hashtag,max=10)# retweets the newest hashtagstime.sleep(3600)# sleep for an hour
Package: tweetrel
How to tweet your releasesSend a tweet to let people know when you release software on GitHub.It's great to release software. And even better when people actually know about it!One way to let people know about your new software releases is to tell them on Twitter. But we're software developers, not social media managers -- so that means weautomate all the things.With tweetrel, you can have GitHub send a tweet for you whenever you make a release.Installpip install tweetrelHow to useFirst, you need to add your Twitter API details asGitHub secrets. You'll need to sign up for aTwitter APIaccount if you don't already have one. Once you've signed up, Twitter will give you four keys:consumer_key,consumer_secret,access_token, andaccess_token_secret. Create a new secret calledTWITTER, and paste those four keys in, with a space between each one.If you need to send Tweets on behalf of a different user to the one attached to your login, you'll need to authenticate with Twitter as that user. Runtweetrel-authin your terminal and follow the instructions, and it will give you theaccess_tokenandaccess_token_secretyou need -- paste them (after a space) after yourconsumer_keyandconsumer_secretand that will let you send tweets as the user you authenticated as.Next, in your terminal,cdto the root of your repo, and then run:tweetrel-installThat will settweetrelup for you to run automatically upon release. You'll see two folders added to your.githubfolder, containing the YAML workflow and python script. No additional setup is needed, other than pushing these to GitHub:gitadd-A.github
gitcommit-am'Addtweetrel`gitpushYou can test this without actually making a release by going to your GitHub repo in your browser, clicking theActionstab, then clicking on thetweetaction, and clicking therun workflowbutton. That will use GitHub's example release payload for testing.Once you've confirmed it's working, try making a release on GitHub, and check that you see the green tick in the Actions tab showing a successful run of thetweetaction.CustomizationAs you'll see, the default template is:New #{repo} release: v{tag_name}. {html_url}\n\n{body}You can customize that by setting theTWEETREL_TEMPLATEenvironment variable. For instance, add this (with suitable indentation) to theenv:section of your workflow YAML file:TWEETREL_TEMPLATE:|Weareproudtoannouncethe{tag_name}releaseof{repo}.Formore,see:{html_url}.Herearethedetails:{body}The|is the YAML character that indicates a multiline string. The sections in{...}are the Python formatting template variables that will be replaced by the details of your release. You don't need to include all of them if you don't want them.