lita-onewheel-snowcrash 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ef79b7a0fa16f334df9aa7462a4c6a3367c2fbe8
4
- data.tar.gz: 276ddc3724e015f94c0ea8598653b2df66c1bca7
3
+ metadata.gz: b2abb5252d2bf386ba1227509d657d122424c879
4
+ data.tar.gz: b1894b65b97ed4a2956365de3407e10598042047
5
5
  SHA512:
6
- metadata.gz: 4f5373e5d0d91711873335147c840eb951b9f97f423672d0e222bb23107ae724478c402c22621bd9bb73611930e477a3f73e0ad25d1be21940c97c9404b19b4a
7
- data.tar.gz: e431e2cd0b0e475d0a4bf67175c970f595b08423f80001a54e4d652098f931e977367882b01661d98fc4ba677f6e0acc19780cef2d0cffccd169940048a4d85f
6
+ metadata.gz: 1653c6f16f6f02c6eefe75041a511450919e19b6a0f6b9e8a99f2599a49f84135d0efd4fd4c5f6c1a9a7bb81ac0fad743973faefb5a65b7850272c7a091ac4bf
7
+ data.tar.gz: 7f6950d80d1b1548aa3045b2a53b21602ab2fbe0f672b05f5496a7a51a18aeaf777a16cdd06d2aa7c2ffa92012da7dacb01d7f5111c7099455a28d498ce6ad06
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.4
4
- - 2.3.0
3
+ - 2.3.4
4
+ - 2.4.1
5
5
  script: bundle exec rake
6
6
  before_install:
7
7
  - gem update --system
data/README.md CHANGED
@@ -10,7 +10,7 @@ Builds a markov chain based on the corpus of Snow Crash by Neal Stephenson.
10
10
  Add lita-onewheel-snowcrash to your Lita instance's Gemfile:
11
11
 
12
12
  ``` ruby
13
- gem 'lita-onewheel-skycrash'
13
+ gem 'lita-onewheel-snowcrash'
14
14
  ```
15
15
 
16
16
  ## Configuration
@@ -16,6 +16,10 @@ module Lita
16
16
  :generate_words_by_number,
17
17
  command: true
18
18
 
19
+ Markov = MarkyMarkov::Dictionary.new('dict/snowcrash')
20
+ Markov.parse_file(File.expand_path('../../dict/snowcrash.txt',
21
+ File.dirname(__FILE__)))
22
+
19
23
  def generate_random_sentence(response)
20
24
  response.reply return_sentence_chain(1)
21
25
  end
@@ -32,26 +36,19 @@ module Lita
32
36
  response.reply return_word_chain(response.matches[0][0])
33
37
  end
34
38
 
35
- def get_markov
36
- puts File.join(File.dirname(File.expand_path(__FILE__)), '../../dict/snowcrash')
37
- # MarkyMarkov::Dictionary.new(File.join(File.dirname(File.expand_path(__FILE__)), 'dict/snowcrash'))
38
- MarkyMarkov::Dictionary.new('dict/snowcrash')
39
- end
40
-
41
39
  def return_word_chain(number)
42
40
  Lita.logger.info "Generating #{number} words."
43
- markov = get_markov # Saves/opens dictionary.mmd
44
- words = markov.generate_n_words(number.to_i)
45
- Lita.logger.info words
46
- words
41
+ log_and_return Markov.generate_n_words(number.to_i)
47
42
  end
48
43
 
49
44
  def return_sentence_chain(number)
50
45
  Lita.logger.info "Generating #{number} sentences."
51
- markov = get_markov # Saves/opens dictionary.mmd
52
- sentences = markov.generate_n_sentences(number.to_i)
53
- Lita.logger.info sentences
54
- sentences
46
+ log_and_return Markov.generate_n_sentences(number.to_i)
47
+ end
48
+
49
+ def log_and_return(message)
50
+ Lita.logger.info message
51
+ message
55
52
  end
56
53
 
57
54
  Lita.register_handler(self)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'lita-onewheel-snowcrash'
3
- spec.version = '1.0.3'
3
+ spec.version = '1.0.4'
4
4
  spec.authors = ['Andrew Kreps']
5
5
  spec.email = ['andrew.kreps@gmail.com']
6
6
  spec.description = %q{Markov generation from a Snow Crash corpus.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lita-onewheel-snowcrash
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kreps
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-28 00:00:00.000000000 Z
11
+ date: 2017-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lita
@@ -177,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  requirements: []
179
179
  rubyforge_project:
180
- rubygems_version: 2.5.1
180
+ rubygems_version: 2.6.11
181
181
  signing_key:
182
182
  specification_version: 4
183
183
  summary: See above.