mirror of
https://github.com/thewesker/allanxaesthetic_ebooks.git
synced 2025-12-20 04:11:07 -05:00
added support for testing from static file
This commit is contained in:
28
ebooks.py
28
ebooks.py
@@ -39,17 +39,23 @@ if __name__=="__main__":
|
|||||||
guess = 0
|
guess = 0
|
||||||
|
|
||||||
if guess == 0:
|
if guess == 0:
|
||||||
user=SOURCE_ACCOUNT
|
if DEBUG==True:
|
||||||
source_tweets = []
|
file = TEST_SOURCE
|
||||||
api=connect()
|
string_list = open(file).readlines()
|
||||||
max_id=None
|
for item in string_list:
|
||||||
for x in range(17)[1:]:
|
source_tweets = item.split(",")
|
||||||
source_tweets_iter, max_id = grab_tweets(api,max_id)
|
else:
|
||||||
source_tweets += source_tweets_iter
|
user=SOURCE_ACCOUNT
|
||||||
print "{0} tweets found".format(len(source_tweets))
|
source_tweets = []
|
||||||
if len(source_tweets) == 0:
|
api=connect()
|
||||||
print "Error fetching tweets from Twitter. Aborting."
|
max_id=None
|
||||||
sys.exit()
|
for x in range(17)[1:]:
|
||||||
|
source_tweets_iter, max_id = grab_tweets(api,max_id)
|
||||||
|
source_tweets += source_tweets_iter
|
||||||
|
print "{0} tweets found".format(len(source_tweets))
|
||||||
|
if len(source_tweets) == 0:
|
||||||
|
print "Error fetching tweets from Twitter. Aborting."
|
||||||
|
sys.exit()
|
||||||
mine = markov.MarkovChainer(order)
|
mine = markov.MarkovChainer(order)
|
||||||
for tweet in source_tweets:
|
for tweet in source_tweets:
|
||||||
if re.search('([\.\!\?\"\']$)', tweet):
|
if re.search('([\.\!\?\"\']$)', tweet):
|
||||||
|
|||||||
@@ -7,4 +7,5 @@ MY_ACCESS_TOKEN_SECRET = 'Your Access Token Secret'
|
|||||||
SOURCE_ACCOUNT = "" #The Twitter handle of the account that you'll generate tweets based on.
|
SOURCE_ACCOUNT = "" #The Twitter handle of the account that you'll generate tweets based on.
|
||||||
ODDS = 8 #How often do you want this to run? 1/8 times?
|
ODDS = 8 #How often do you want this to run? 1/8 times?
|
||||||
ORDER = 2 #how closely do you want this to hew to sensical? 1 is low and 3 is high.
|
ORDER = 2 #how closely do you want this to hew to sensical? 1 is low and 3 is high.
|
||||||
DEBUG = True #Set this to False to start Tweeting live
|
DEBUG = True #Set this to False to start Tweeting live
|
||||||
|
TEST_SOURCE = "" #The name of a text file of a string-ified list for testing. To avoid unnecessarily hitting Twitter API.
|
||||||
Reference in New Issue
Block a user