Permalink
Browse files

Merge branch 'master' of github.com:garside/Markov-Generator-For-Time…

…cube
  • Loading branch information...
2 parents 82802ef + 44dee55 commit a7aea28e7cd6a1dbdd13f430f37cb874dbe0c192 Eric Garside committed Feb 16, 2012
Showing with 100,385 additions and 21 deletions.
  1. +0 −1 .gitignore
  2. +99,817 −0 bible.txt
  3. +1 −0 markov.py
  4. +14 −16 run_suite.sh
  5. +16 −0 run_tweet.sh
  6. +1 −4 src.txt
  7. +68 −0 timecubeunfollow.py
  8. +468 −0 trending.txt
View
@@ -1 +0,0 @@
-trends.txt
View
Oops, something went wrong.
View
@@ -47,6 +47,7 @@ def srcparse(src):
sentences = tokenizer.tokenize(src.strip().lower())
rm = compile(r'[*.?!,\'":;\(\)<>]')
sp = compile(r'[\-\+]')
+ biblesection = compile(r'\d*:\d')
starts, joins, ends = [], {}, []
View
@@ -2,21 +2,19 @@
echo `dirname "$0" `
cd `dirname "$0" `
./timecubetrends.py > trending.txt
-for i in 1 2 3 4
-do
- sleep 1
- selection=$RANDOM
- echo $selection
- if [ "$selection" -gt "30719" ]; then
- # Mention: 1/16
- ./markov.py --length 1 --for_twitter --input src.txt --mention `./timecuberandomuser.py` | ./timecubetweet.py
- elif [ "$selection" -gt "26623" ]; then
- # Trending: 2/16
- ./markov.py --length 1 --for_twitter --input src.txt --trending trending.txt | ./timecubetweet.py
- else
- # Normal: 13/16
- ./markov.py --length 1 --for_twitter --input src.txt | ./timecubetweet.py
- fi
-done
sleep 1
+selection=$RANDOM
+echo $selection
+if [ "$selection" -gt "30719" ]; then
+ # Mention: 1/16
+ ./markov.py --length 1 --for_twitter --input src.txt --mention `./timecuberandomuser.py` | ./timecubetweet.py
+elif [ "$selection" -gt "26623" ]; then
+ # Trending: 2/16
+ ./markov.py --length 1 --for_twitter --input src.txt --trending trending.txt | ./timecubetweet.py
+else
+ # Normal: 13/16
+ ./markov.py --length 1 --for_twitter --input src.txt | ./timecubetweet.py
+fi
+sleep 1
+./timecubeunfollow.py -n 24
./timecubefollow.py -n 24
View
@@ -0,0 +1,16 @@
+#/bin/bash
+echo `dirname "$0" `
+cd `dirname "$0" `
+./timecubetrends.py > trending.txt
+selection=$RANDOM
+echo $selection
+if [ "$selection" -gt "30719" ]; then
+ # Mention: 1/16
+ ./markov.py --length 1 --for_twitter --input src.txt --mention `./timecuberandomuser.py` | ./timecubetweet.py
+elif [ "$selection" -gt "26623" ]; then
+ # Trending: 2/16
+ ./markov.py --length 1 --for_twitter --input src.txt --trending trending.txt | ./timecubetweet.py
+else
+ # Normal: 13/16
+ ./markov.py --length 1 --for_twitter --input src.txt | ./timecubetweet.py
+fi
View
@@ -926,8 +926,6 @@ ever.
Remember "U.S.S. Liberty",
where
- Jews slaughter American sailors.
-
How
many whites died while
freeing
@@ -2667,8 +2665,7 @@ Cube4 Intelligence,
are EVIL to deny they evolved from children and claim their adult EGO image
is a god likeness. Such damn evil AMERICANS should have their tongue cut out
for the heinous hoax they are perpetrating upon their own children. I know
- now why the Jews
- deserved their holocaust worshipping
+ deserved their holocaust - worshipping
their own adult EGO image as a damn god whil
ignoring and betraying the very children who sacrifice their LIFE
so their Moms and Dads could Live. There is
View
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+from tools.tweet import *
+import sys
+import datetime
+import random
+from optparse import OptionParser
+
+def unfollow(config, num):
+ api = twitter_connect(config)
+ friend_ids = api.friends_ids()
+ follower_ids = api.followers_ids()
+ itercnt = 0
+ total = num * 10
+ while num > 0:
+ fid = random.choice(friend_ids)
+ if fid not in follower_ids:
+ user = api.get_user(fid)
+ ratio = 0.0
+ if user.friends_count > 0:
+ ratio = float(user.followers_count) / float(user.friends_count)
+ if user.followers_count > 2000:
+ print "Popular: %s" % fid
+ elif ratio < 0.35:
+ num -= 1
+ api.destroy_friendship(fid)
+ print "Removing: %s" % fid
+ else:
+ print "Descriminating: %s" % fid
+ else:
+ print "Keeping: %s" % fid
+ itercnt += 1
+ if itercnt > total:
+ return
+
+def follow_followers(api, followers):
+ for follower in followers:
+ do_follow(api, follower)
+
+def select_follower(followers):
+ return random.sample(followers, 1)[0]
+
+def do_unfollow(api, user, num=0):
+ if not user.following:
+ num = num - 1
+ try:
+ api.create_friendship(user.screen_name)
+ print "Victim: %s" % user.name
+ except:
+ # Something failed in the follow, accept that and move on
+ pass
+ return num
+
+def option_parser():
+ parser = OptionParser(usage="Follows random followers of timecube followers on the Moar Time Cube twitter account.")
+ parser.add_option("-n", "--num", dest="num", default="10", help="number of random people to follow")
+ return parser
+
+def main():
+ parser = option_parser()
+ (options, args) = parser.parse_args()
+ config = get_config()
+ num = int(options.num)
+ random.seed(datetime.datetime.now())
+ unfollow(config, num)
+
+if __name__ == "__main__":
+ main()
+
Oops, something went wrong.

0 comments on commit a7aea28

Please sign in to comment.