twitter_ebooks 2.3.1 → 2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/twitter_ebooks/model.rb +10 -6
- data/lib/twitter_ebooks/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c11c99337f28c765e0061e6e9a541ae3def2eb3
|
4
|
+
data.tar.gz: aeb8bf213b41972ea1257e3b5f4bba14a2df88c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07955ae0c6fb60549ad3fb48dc742ea6378e889c9ef9300bce7a78ef56ab11990c1a2d76f5046f62b1b75dca9dbb5165860d70d5db3dc6a7e5be28915a306f19
|
7
|
+
data.tar.gz: 3d4a3459c7fe881c92773fe3d0b40dc32e440aaa208cf95f010a8d541fa826760a86370adcbbda1a4f93e448ace3d3089fd454eb808c37cdbbcd0bdbd870dc04
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# twitter\_ebooks 2.3.
|
1
|
+
# twitter\_ebooks 2.3.2
|
2
2
|
|
3
3
|
Rewrite of my twitter\_ebooks code. While the original was solely a tweeting Markov generator, this framework helps you build any kind of interactive twitterbot which responds to mentions/DMs. See [ebooks\_example](https://github.com/mispy/ebooks_example) for an example of a full bot.
|
4
4
|
|
data/lib/twitter_ebooks/model.rb
CHANGED
@@ -8,18 +8,22 @@ require 'csv'
|
|
8
8
|
|
9
9
|
module Ebooks
|
10
10
|
class Model
|
11
|
-
attr_accessor :hash, :sentences, :mentions, :keywords
|
11
|
+
attr_accessor :hash, :tokens, :sentences, :mentions, :keywords
|
12
12
|
|
13
13
|
def self.consume(txtpath)
|
14
14
|
Model.new.consume(txtpath)
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.load(path)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
model = Model.new
|
19
|
+
model.instance_eval do
|
20
|
+
props = Marshal.load(File.open(path, 'rb') { |f| f.read })
|
21
|
+
@tokens = props[:tokens]
|
22
|
+
@sentences = props[:sentences]
|
23
|
+
@mentions = props[:mentions]
|
24
|
+
@keywords = props[:keywords]
|
25
|
+
end
|
26
|
+
model
|
23
27
|
end
|
24
28
|
|
25
29
|
def save(path)
|