A few days ago I wanted to build a tools to cut a long text into one hundred-letters strings with the number of the tweets and which part of the tweets the tweet belongs to.
I tried to have a tweet with one-hundred characters long but I could not find anything relevant to [1/x]
This is my tool:
import tweepy
n = 100
with open('texte-tw.txt','r') as input_file:
abc = []
for lines in input_file:
abc.extend([lines[i:i+n] for i in range(0,len(lines),n)])
abc = [i.replace('\n','') for i in abc]
abc = list(filter(bool, abc))
ckey = 'xxx'
csecret = 'yyy'
atoken = 'uuu'
asecret = 'zzz'
auth = tweepy.OAuthHandler(ckey,csecret)
auth.set_access_token(atoken,asecret)
api = tweepy.API(auth)
for i,val in enumerate(abc):
api.update_status(status=(val+' ['+str(i+1)+'/'+str(len(abc))+']'))
This is an extract of my file:
While it should be clear that we need a means of representing and reasoningabout uncertainty, it is not immediately obvious that probability theory can provideall of the tools we want for artificial intelligence applications. Probability theorywas originally developed to analyze the frequencies of events. It is easy to seehow probability theory can be used to study events like drawing a certain hand ofcards in a game of poker. These kinds of events are often repeatable. When wesay that an outcome has a probabilitypof occurring, it means that if we repeatedthe experiment (e.g., draw a hand of cards) infinitely many times, then proportionpof the repetitions would result in that outcome.
Questions are the following:
- What can I do to improve my solution?
- Is there a way to cut with words that will be around one-hundred characters (+/- 10 characters) long tweet?
- Are there way to package everything and that the solution will run with just one click (using Tkinter or something similar)?