twitter_ebooks 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,15 +1,15 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- twitter_ebooks (2.0.0)
4
+ twitter_ebooks (2.0.3)
5
+ bloomfilter-rb
5
6
  engtagger
7
+ fast-stemmer
6
8
  gingerice
9
+ highscore
7
10
  htmlentities
8
- linguistics
9
- ruby-stemmer
11
+ minitest
10
12
  rufus-scheduler
11
- tactful_tokenizer
12
- tokenizer
13
13
  tweetstream
14
14
  twitter
15
15
 
@@ -19,6 +19,8 @@ GEM
19
19
  addressable (2.3.5)
20
20
  atomic (1.1.14)
21
21
  awesome_print (1.2.0)
22
+ bloomfilter-rb (2.1.1)
23
+ redis
22
24
  cookiejar (0.3.0)
23
25
  daemons (1.1.9)
24
26
  em-http-request (1.0.3)
@@ -37,25 +39,23 @@ GEM
37
39
  eventmachine (1.0.3)
38
40
  faraday (0.8.8)
39
41
  multipart-post (~> 1.2.0)
42
+ fast-stemmer (1.0.2)
40
43
  gingerice (1.2.1)
41
44
  addressable
42
45
  awesome_print
46
+ highscore (1.1.0)
47
+ whatlanguage (>= 1.0.0)
43
48
  htmlentities (4.3.1)
44
49
  http_parser.rb (0.5.3)
45
- linguistics (2.0.2)
46
- loggability (~> 0.5)
47
- loggability (0.8.1)
48
50
  minitest (5.0.8)
49
51
  multi_json (1.8.2)
50
52
  multipart-post (1.2.0)
51
- ruby-stemmer (0.9.3)
53
+ redis (3.0.5)
52
54
  rufus-scheduler (3.0.2)
53
55
  tzinfo
54
56
  simple_oauth (0.2.0)
55
- tactful_tokenizer (0.0.2)
56
57
  thread_safe (0.1.3)
57
58
  atomic
58
- tokenizer (0.1.1)
59
59
  tweetstream (2.5.0)
60
60
  daemons (~> 1.1)
61
61
  em-http-request (~> 1.0.2)
@@ -68,11 +68,11 @@ GEM
68
68
  simple_oauth (~> 0.2)
69
69
  tzinfo (1.1.0)
70
70
  thread_safe (~> 0.1)
71
+ whatlanguage (1.0.5)
71
72
  yajl-ruby (1.1.0)
72
73
 
73
74
  PLATFORMS
74
75
  ruby
75
76
 
76
77
  DEPENDENCIES
77
- minitest
78
78
  twitter_ebooks!
data/bin/ebooks CHANGED
@@ -44,11 +44,7 @@ module Ebooks
44
44
  end
45
45
 
46
46
  def self.gen(model_path, input)
47
- require 'benchmark'
48
- model = nil;
49
- puts Benchmark.measure {
50
- model = Model.load(model_path)
51
- }
47
+ model = Model.load(model_path)
52
48
  if input && !input.empty?
53
49
  puts "@cmd " + model.markov_response(input, 135)
54
50
  else
@@ -56,16 +52,33 @@ module Ebooks
56
52
  end
57
53
  end
58
54
 
55
+ def self.score(model_path, input)
56
+ model = Model.load(model_path)
57
+ model.score_interest(input)
58
+ end
59
+
59
60
  def self.archive(username, outpath)
60
61
  Archiver.new(username, outpath).fetch_tweets
61
62
  end
62
63
 
64
+ def self.tweet(modelpath, username)
65
+ load File.join(APP_PATH, 'bots.rb')
66
+ model = Model.load(modelpath)
67
+ statement = model.markov_statement
68
+ log "@#{username}: #{statement}"
69
+ bot = Bot.get(username)
70
+ bot.configure
71
+ bot.tweet(statement)
72
+ end
73
+
63
74
  def self.command(args)
64
75
  usage = """Usage:
65
76
  ebooks new <reponame>
66
77
  ebooks consume <corpus_path> [...]
67
- ebooks gen <model> [input]
78
+ ebooks gen <model_path> [input]
79
+ ebooks score <model_path> <input>
68
80
  ebooks archive <@user> <outpath>
81
+ ebooks tweet <model_path> <@bot>
69
82
  """
70
83
 
71
84
  if args.length == 0
@@ -77,7 +90,9 @@ module Ebooks
77
90
  when "new" then new(args[1])
78
91
  when "consume" then consume(args[1..-1])
79
92
  when "gen" then gen(args[1], args[2..-1].join(' '))
93
+ when "score" then score(args[1], args[2..-1].join(' '))
80
94
  when "archive" then archive(args[1], args[2])
95
+ when "tweet" then tweet(args[1], args[2])
81
96
  end
82
97
  end
83
98
  end