megahal 1.0.4 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -6
- data/Gemfile +2 -2
- data/Gemfile.lock +61 -36
- data/README.md +1 -1
- data/VERSION +1 -1
- data/lib/megahal/megahal.rb +49 -28
- data/megahal.gemspec +9 -9
- data/spec/megahal_spec.rb +13 -11
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48fcb4631d15527c3db8699baeb01f8fd0a4e2c3
|
4
|
+
data.tar.gz: 5fe03f6b1a035bd3cdf56a8d6427ae63ac6d6f42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d21d82961058292a3791fe489ba6cc72a3ed290f6bb7f419f640248577aef62369698aff5c79c90474f4e989da216393ba37e4f517a30e2aaf500a55d47b2a2
|
7
|
+
data.tar.gz: 273a06ea5ffda6bed59344e33d12d2f294fda565fb4d88ca40b99c04c6b23f1cffe4c6a4720c9062264f673513957c4e6632acb46b5aa744c6174e2e92629fa3
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## [v1.0.
|
3
|
+
## [v1.0.4](https://github.com/jasonhutchens/megahal/tree/v1.0.4) (2015-10-03)
|
4
|
+
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v1.0.3...v1.0.4)
|
4
5
|
|
6
|
+
## [v1.0.3](https://github.com/jasonhutchens/megahal/tree/v1.0.3) (2015-05-26)
|
5
7
|
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v1.0.2...v1.0.3)
|
6
8
|
|
7
9
|
## [v1.0.2](https://github.com/jasonhutchens/megahal/tree/v1.0.2) (2015-05-26)
|
8
|
-
|
9
10
|
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v1.0.1...v1.0.2)
|
10
11
|
|
11
12
|
**Closed issues:**
|
@@ -13,19 +14,15 @@
|
|
13
14
|
- Test Issue [\#1](https://github.com/jasonhutchens/megahal/issues/1)
|
14
15
|
|
15
16
|
## [v1.0.1](https://github.com/jasonhutchens/megahal/tree/v1.0.1) (2014-12-22)
|
16
|
-
|
17
17
|
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v1.0.0...v1.0.1)
|
18
18
|
|
19
19
|
## [v1.0.0](https://github.com/jasonhutchens/megahal/tree/v1.0.0) (2014-12-17)
|
20
|
-
|
21
20
|
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v0.5.0...v1.0.0)
|
22
21
|
|
23
22
|
## [v0.5.0](https://github.com/jasonhutchens/megahal/tree/v0.5.0) (2014-12-17)
|
24
|
-
|
25
23
|
[Full Changelog](https://github.com/jasonhutchens/megahal/compare/v0.4.0...v0.5.0)
|
26
24
|
|
27
25
|
## [v0.4.0](https://github.com/jasonhutchens/megahal/tree/v0.4.0) (2014-12-17)
|
28
26
|
|
29
27
|
|
30
|
-
|
31
28
|
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'sooth', '~>
|
3
|
+
gem 'sooth', '~> 2.0'
|
4
4
|
gem 'highline', '~> 1.7'
|
5
5
|
gem 'ruby-progressbar', '~> 1.7'
|
6
6
|
gem 'rubyzip', '~> 1.1'
|
@@ -13,6 +13,6 @@ group :development do
|
|
13
13
|
gem 'bundler', '~> 1.7'
|
14
14
|
gem 'jeweler', '~> 2.0'
|
15
15
|
gem 'simplecov', '~> 0.10'
|
16
|
-
gem 'byebug', '~>
|
16
|
+
gem 'byebug', '~> 8.2'
|
17
17
|
gem 'github_changelog_generator', '~> 1.4'
|
18
18
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,9 +1,12 @@
|
|
1
1
|
GEM
|
2
2
|
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
4
|
+
addressable (2.4.0)
|
5
|
+
ast (2.2.0)
|
5
6
|
builder (3.2.2)
|
6
|
-
byebug (
|
7
|
+
byebug (8.2.2)
|
8
|
+
childprocess (0.5.9)
|
9
|
+
ffi (~> 1.0, >= 1.0.11)
|
7
10
|
cld (0.7.0)
|
8
11
|
ffi
|
9
12
|
colorize (0.7.7)
|
@@ -11,24 +14,29 @@ GEM
|
|
11
14
|
thread_safe (~> 0.3, >= 0.3.1)
|
12
15
|
diff-lcs (1.2.5)
|
13
16
|
docile (1.1.5)
|
14
|
-
faraday (0.9.
|
17
|
+
faraday (0.9.2)
|
15
18
|
multipart-post (>= 1.2, < 3)
|
16
19
|
ffi (1.9.10)
|
17
|
-
git (1.
|
18
|
-
github_api (0.
|
19
|
-
addressable (~> 2.
|
20
|
+
git (1.3.0)
|
21
|
+
github_api (0.13.1)
|
22
|
+
addressable (~> 2.4.0)
|
20
23
|
descendants_tracker (~> 0.0.4)
|
21
24
|
faraday (~> 0.8, < 0.10)
|
22
25
|
hashie (>= 3.4)
|
23
26
|
multi_json (>= 1.7.5, < 2.0)
|
24
|
-
nokogiri (~> 1.6.6)
|
25
27
|
oauth2
|
26
|
-
github_changelog_generator (1.
|
28
|
+
github_changelog_generator (1.12.0)
|
29
|
+
bundler (>= 1.7)
|
27
30
|
colorize (~> 0.7)
|
28
31
|
github_api (~> 0.12)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
+
overcommit (>= 0.31)
|
33
|
+
rake (>= 10.0)
|
34
|
+
rspec (>= 3.2)
|
35
|
+
rubocop (>= 0.31)
|
36
|
+
hashie (3.4.3)
|
37
|
+
highline (1.7.8)
|
38
|
+
iniparse (1.4.2)
|
39
|
+
jeweler (2.1.1)
|
32
40
|
builder
|
33
41
|
bundler (>= 1.0)
|
34
42
|
git (>= 1.2.5)
|
@@ -37,45 +45,62 @@ GEM
|
|
37
45
|
nokogiri (>= 1.5.10)
|
38
46
|
rake
|
39
47
|
rdoc
|
48
|
+
semver
|
40
49
|
json (1.8.3)
|
41
50
|
jwt (1.5.1)
|
42
|
-
|
51
|
+
mini_portile2 (2.0.0)
|
43
52
|
multi_json (1.11.2)
|
44
53
|
multi_xml (0.5.5)
|
45
54
|
multipart-post (2.0.0)
|
46
|
-
nokogiri (1.6.
|
47
|
-
|
48
|
-
oauth2 (1.
|
55
|
+
nokogiri (1.6.7.2)
|
56
|
+
mini_portile2 (~> 2.0.0.rc2)
|
57
|
+
oauth2 (1.1.0)
|
49
58
|
faraday (>= 0.8, < 0.10)
|
50
|
-
jwt (~> 1.0)
|
59
|
+
jwt (~> 1.0, < 1.5.2)
|
51
60
|
multi_json (~> 1.3)
|
52
61
|
multi_xml (~> 0.5)
|
53
|
-
rack (
|
62
|
+
rack (>= 1.2, < 3)
|
63
|
+
overcommit (0.33.0)
|
64
|
+
childprocess (~> 0.5.8)
|
65
|
+
iniparse (~> 1.4)
|
66
|
+
parser (2.3.0.7)
|
67
|
+
ast (~> 2.2)
|
68
|
+
powerpack (0.1.1)
|
54
69
|
rack (1.6.4)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
rspec-
|
61
|
-
|
62
|
-
rspec-
|
63
|
-
rspec-
|
70
|
+
rainbow (2.1.0)
|
71
|
+
rake (11.1.2)
|
72
|
+
rdoc (4.2.2)
|
73
|
+
json (~> 1.4)
|
74
|
+
rspec (3.4.0)
|
75
|
+
rspec-core (~> 3.4.0)
|
76
|
+
rspec-expectations (~> 3.4.0)
|
77
|
+
rspec-mocks (~> 3.4.0)
|
78
|
+
rspec-core (3.4.4)
|
79
|
+
rspec-support (~> 3.4.0)
|
80
|
+
rspec-expectations (3.4.0)
|
64
81
|
diff-lcs (>= 1.2.0, < 2.0)
|
65
|
-
rspec-support (~> 3.
|
66
|
-
rspec-mocks (3.
|
82
|
+
rspec-support (~> 3.4.0)
|
83
|
+
rspec-mocks (3.4.1)
|
67
84
|
diff-lcs (>= 1.2.0, < 2.0)
|
68
|
-
rspec-support (~> 3.
|
69
|
-
rspec-support (3.
|
85
|
+
rspec-support (~> 3.4.0)
|
86
|
+
rspec-support (3.4.1)
|
87
|
+
rubocop (0.39.0)
|
88
|
+
parser (>= 2.3.0.7, < 3.0)
|
89
|
+
powerpack (~> 0.1)
|
90
|
+
rainbow (>= 1.99.1, < 3.0)
|
91
|
+
ruby-progressbar (~> 1.7)
|
92
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
70
93
|
ruby-progressbar (1.7.5)
|
71
|
-
rubyzip (1.
|
72
|
-
|
94
|
+
rubyzip (1.2.0)
|
95
|
+
semver (1.0.1)
|
96
|
+
simplecov (0.11.2)
|
73
97
|
docile (~> 1.1.0)
|
74
98
|
json (~> 1.8)
|
75
99
|
simplecov-html (~> 0.10.0)
|
76
100
|
simplecov-html (0.10.0)
|
77
|
-
sooth (
|
101
|
+
sooth (2.0.0)
|
78
102
|
thread_safe (0.3.5)
|
103
|
+
unicode-display_width (1.0.3)
|
79
104
|
yard (0.8.7.6)
|
80
105
|
|
81
106
|
PLATFORMS
|
@@ -83,7 +108,7 @@ PLATFORMS
|
|
83
108
|
|
84
109
|
DEPENDENCIES
|
85
110
|
bundler (~> 1.7)
|
86
|
-
byebug (~>
|
111
|
+
byebug (~> 8.2)
|
87
112
|
cld (~> 0.7)
|
88
113
|
github_changelog_generator (~> 1.4)
|
89
114
|
highline (~> 1.7)
|
@@ -93,8 +118,8 @@ DEPENDENCIES
|
|
93
118
|
ruby-progressbar (~> 1.7)
|
94
119
|
rubyzip (~> 1.1)
|
95
120
|
simplecov (~> 0.10)
|
96
|
-
sooth (~>
|
121
|
+
sooth (~> 2.0)
|
97
122
|
yard (~> 0.8)
|
98
123
|
|
99
124
|
BUNDLED WITH
|
100
|
-
1.
|
125
|
+
1.11.2
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/lib/megahal/megahal.rb
CHANGED
@@ -31,6 +31,7 @@ class MegaHAL
|
|
31
31
|
@case.clear
|
32
32
|
@punc.clear
|
33
33
|
@dictionary = { "<error>" => 0, "<fence>" => 1, "<blank>" => 2 }
|
34
|
+
@brain = {}
|
34
35
|
nil
|
35
36
|
end
|
36
37
|
|
@@ -112,11 +113,13 @@ class MegaHAL
|
|
112
113
|
bar.total = 6 unless bar.nil?
|
113
114
|
Zip::File.open(filename, Zip::File::CREATE) do |zipfile|
|
114
115
|
zipfile.get_output_stream("dictionary") do |file|
|
115
|
-
|
116
|
-
version: '
|
116
|
+
data = {
|
117
|
+
version: 'MH11',
|
117
118
|
learning: @learning,
|
119
|
+
brain: @brain,
|
118
120
|
dictionary: @dictionary
|
119
|
-
}
|
121
|
+
}
|
122
|
+
file.write(Marshal::dump(data))
|
120
123
|
end
|
121
124
|
bar.increment unless bar.nil?
|
122
125
|
[:seed, :fore, :back, :case, :punc].each do |name|
|
@@ -135,10 +138,11 @@ class MegaHAL
|
|
135
138
|
def load(filename, bar = nil)
|
136
139
|
bar.total = 6 unless bar.nil?
|
137
140
|
Zip::File.open(filename) do |zipfile|
|
138
|
-
data =
|
139
|
-
raise "bad version" unless data[
|
140
|
-
@learning = data[
|
141
|
-
@
|
141
|
+
data = Marshal::load(zipfile.find_entry("dictionary").get_input_stream.read)
|
142
|
+
raise "bad version" unless data[:version] == "MH11"
|
143
|
+
@learning = data[:learning]
|
144
|
+
@brain = data[:brain]
|
145
|
+
@dictionary = data[:dictionary]
|
142
146
|
bar.increment unless bar.nil?
|
143
147
|
[:seed, :fore, :back, :case, :punc].each do |name|
|
144
148
|
tmp = _get_tmp_filename(name)
|
@@ -195,9 +199,11 @@ class MegaHAL
|
|
195
199
|
prev = 1
|
196
200
|
(norm_symbols + [1]).each do |norm|
|
197
201
|
context = [prev, 2]
|
198
|
-
@
|
202
|
+
id = @brain[context.dup] ||= @brain.length
|
203
|
+
@seed.observe(id, norm)
|
199
204
|
context = [2, norm]
|
200
|
-
@
|
205
|
+
id = @brain[context.dup] ||= @brain.length
|
206
|
+
@seed.observe(id, prev)
|
201
207
|
prev = norm
|
202
208
|
end
|
203
209
|
|
@@ -207,11 +213,13 @@ class MegaHAL
|
|
207
213
|
# special <fence> symbol (which has ID 1) is used to delimit the utterance.
|
208
214
|
context = [1, 1]
|
209
215
|
norm_symbols.each do |norm|
|
210
|
-
@
|
216
|
+
id = @brain[context.dup] ||= @brain.length
|
217
|
+
@fore.observe(id, norm)
|
211
218
|
context << norm
|
212
219
|
context.shift
|
213
220
|
end
|
214
|
-
@
|
221
|
+
id = @brain[context.dup] ||= @brain.length
|
222
|
+
@fore.observe(id, 1)
|
215
223
|
|
216
224
|
# The @back model is similar to the @fore model; it simply operates in the
|
217
225
|
# opposite direction. This is how the original MegaHAL was able to generate
|
@@ -220,11 +228,13 @@ class MegaHAL
|
|
220
228
|
# the gaps towards the beginning of the sentence.
|
221
229
|
context = [1, 1]
|
222
230
|
norm_symbols.reverse.each do |norm|
|
223
|
-
@
|
231
|
+
id = @brain[context.dup] ||= @brain.length
|
232
|
+
@back.observe(id, norm)
|
224
233
|
context << norm
|
225
234
|
context.shift
|
226
235
|
end
|
227
|
-
@
|
236
|
+
id = @brain[context.dup] ||= @brain.length
|
237
|
+
@back.observe(id, 1)
|
228
238
|
|
229
239
|
# The previous three models were all learning the sequence of norms, which
|
230
240
|
# are capitalised words. When we generate a reply, we want to rewrite it so
|
@@ -233,7 +243,8 @@ class MegaHAL
|
|
233
243
|
context = [1, 1]
|
234
244
|
word_symbols.zip(norm_symbols).each do |word, norm|
|
235
245
|
context[1] = norm
|
236
|
-
@
|
246
|
+
id = @brain[context.dup] ||= @brain.length
|
247
|
+
@case.observe(id, word)
|
237
248
|
context[0] = word
|
238
249
|
end
|
239
250
|
|
@@ -245,7 +256,8 @@ class MegaHAL
|
|
245
256
|
punc_symbols.zip(word_symbols + [1]).each do |punc, word|
|
246
257
|
context << word
|
247
258
|
context.shift
|
248
|
-
@
|
259
|
+
id = @brain[context.dup] ||= @brain.length
|
260
|
+
@punc.observe(id, punc)
|
249
261
|
end
|
250
262
|
end
|
251
263
|
|
@@ -294,10 +306,12 @@ class MegaHAL
|
|
294
306
|
# Use the @seed model to find two contexts that contain the keyword.
|
295
307
|
contexts = [[2, keyword], [keyword, 2]]
|
296
308
|
contexts.map! do |context|
|
297
|
-
|
309
|
+
id = @brain[context.dup] ||= @brain.length
|
310
|
+
count = @seed.count(id)
|
298
311
|
if count > 0
|
299
|
-
|
300
|
-
|
312
|
+
id = @brain[context.dup] ||= @brain.length
|
313
|
+
limit = @seed.count(id)
|
314
|
+
context[context.index(2)] = @seed.select(id, limit)
|
301
315
|
context
|
302
316
|
else
|
303
317
|
nil
|
@@ -329,13 +343,15 @@ class MegaHAL
|
|
329
343
|
def _random_walk(model, static_context, keyword_symbols)
|
330
344
|
context = static_context.dup
|
331
345
|
results = []
|
332
|
-
|
346
|
+
id = @brain[context.dup] ||= @brain.length
|
347
|
+
return [] if model.count(id) == 0
|
333
348
|
local_keywords = keyword_symbols.dup
|
334
349
|
loop do
|
335
350
|
symbol = 0
|
336
351
|
10.times do
|
337
|
-
|
338
|
-
|
352
|
+
id = @brain[context.dup] ||= @brain.length
|
353
|
+
limit = rand(model.count(id)) + 1
|
354
|
+
symbol = model.select(id, limit)
|
339
355
|
if local_keywords.include?(symbol)
|
340
356
|
local_keywords.delete(symbol)
|
341
357
|
break
|
@@ -373,7 +389,8 @@ class MegaHAL
|
|
373
389
|
context = [1, 1]
|
374
390
|
utterance.each do |norm|
|
375
391
|
if keyword_symbols.include?(norm)
|
376
|
-
|
392
|
+
id = @brain[context.dup] ||= @brain.length
|
393
|
+
surprise = @fore.surprise(id, norm)
|
377
394
|
score += surprise unless surprise.nil?
|
378
395
|
end
|
379
396
|
context << norm
|
@@ -383,7 +400,8 @@ class MegaHAL
|
|
383
400
|
context = [1, 1]
|
384
401
|
utterance.reverse.each do |norm|
|
385
402
|
if keyword_symbols.include?(norm)
|
386
|
-
|
403
|
+
id = @brain[context.dup] ||= @brain.length
|
404
|
+
surprise = @back.surprise(id, norm)
|
387
405
|
score += surprise unless surprise.nil?
|
388
406
|
end
|
389
407
|
context << norm
|
@@ -429,16 +447,18 @@ class MegaHAL
|
|
429
447
|
# what was observed previously.
|
430
448
|
context[0] = (i == 0) ? 1 : word_symbols[i-1]
|
431
449
|
context[1] = norm_symbols[i]
|
432
|
-
|
450
|
+
id = @brain[context.dup] ||= @brain.length
|
451
|
+
count = @case.count(id)
|
433
452
|
unless failed = (count == 0)
|
434
453
|
limit = rand(count) + 1
|
435
|
-
word_symbols << @case.select(
|
454
|
+
word_symbols << @case.select(id, limit)
|
436
455
|
end
|
437
456
|
if (word_symbols.length == norm_symbols.length)
|
438
457
|
# We need to check that the final word has been previously observed.
|
439
458
|
context[0] = word_symbols.last
|
440
459
|
context[1] = 1
|
441
|
-
|
460
|
+
id = @brain[context.dup] ||= @brain.length
|
461
|
+
failed = (@punc.count(id) == 0)
|
442
462
|
end
|
443
463
|
if failed
|
444
464
|
retries += 1
|
@@ -458,8 +478,9 @@ class MegaHAL
|
|
458
478
|
(word_symbols + [1]).each do |word|
|
459
479
|
context << word
|
460
480
|
context.shift
|
461
|
-
|
462
|
-
|
481
|
+
id = @brain[context.dup] ||= @brain.length
|
482
|
+
limit = rand(@punc.count(id)) + 1
|
483
|
+
punc_symbols << @punc.select(id, limit)
|
463
484
|
end
|
464
485
|
|
465
486
|
# Finally we zip the word-separators and the words together, decode the
|
data/megahal.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: megahal
|
5
|
+
# stub: megahal 2.0.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "megahal"
|
9
|
-
s.version = "
|
9
|
+
s.version = "2.0.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Jason Hutchens"]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2016-04-06"
|
15
15
|
s.description = "Have a weird conversation with a computer."
|
16
16
|
s.email = "jasonhutchens@gmail.com"
|
17
17
|
s.executables = ["megahal"]
|
@@ -58,7 +58,7 @@ Gem::Specification.new do |s|
|
|
58
58
|
s.specification_version = 4
|
59
59
|
|
60
60
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
61
|
-
s.add_runtime_dependency(%q<sooth>, ["~>
|
61
|
+
s.add_runtime_dependency(%q<sooth>, ["~> 2.0"])
|
62
62
|
s.add_runtime_dependency(%q<highline>, ["~> 1.7"])
|
63
63
|
s.add_runtime_dependency(%q<ruby-progressbar>, ["~> 1.7"])
|
64
64
|
s.add_runtime_dependency(%q<rubyzip>, ["~> 1.1"])
|
@@ -69,10 +69,10 @@ Gem::Specification.new do |s|
|
|
69
69
|
s.add_development_dependency(%q<bundler>, ["~> 1.7"])
|
70
70
|
s.add_development_dependency(%q<jeweler>, ["~> 2.0"])
|
71
71
|
s.add_development_dependency(%q<simplecov>, ["~> 0.10"])
|
72
|
-
s.add_development_dependency(%q<byebug>, ["~>
|
72
|
+
s.add_development_dependency(%q<byebug>, ["~> 8.2"])
|
73
73
|
s.add_development_dependency(%q<github_changelog_generator>, ["~> 1.4"])
|
74
74
|
else
|
75
|
-
s.add_dependency(%q<sooth>, ["~>
|
75
|
+
s.add_dependency(%q<sooth>, ["~> 2.0"])
|
76
76
|
s.add_dependency(%q<highline>, ["~> 1.7"])
|
77
77
|
s.add_dependency(%q<ruby-progressbar>, ["~> 1.7"])
|
78
78
|
s.add_dependency(%q<rubyzip>, ["~> 1.1"])
|
@@ -83,11 +83,11 @@ Gem::Specification.new do |s|
|
|
83
83
|
s.add_dependency(%q<bundler>, ["~> 1.7"])
|
84
84
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
85
85
|
s.add_dependency(%q<simplecov>, ["~> 0.10"])
|
86
|
-
s.add_dependency(%q<byebug>, ["~>
|
86
|
+
s.add_dependency(%q<byebug>, ["~> 8.2"])
|
87
87
|
s.add_dependency(%q<github_changelog_generator>, ["~> 1.4"])
|
88
88
|
end
|
89
89
|
else
|
90
|
-
s.add_dependency(%q<sooth>, ["~>
|
90
|
+
s.add_dependency(%q<sooth>, ["~> 2.0"])
|
91
91
|
s.add_dependency(%q<highline>, ["~> 1.7"])
|
92
92
|
s.add_dependency(%q<ruby-progressbar>, ["~> 1.7"])
|
93
93
|
s.add_dependency(%q<rubyzip>, ["~> 1.1"])
|
@@ -98,7 +98,7 @@ Gem::Specification.new do |s|
|
|
98
98
|
s.add_dependency(%q<bundler>, ["~> 1.7"])
|
99
99
|
s.add_dependency(%q<jeweler>, ["~> 2.0"])
|
100
100
|
s.add_dependency(%q<simplecov>, ["~> 0.10"])
|
101
|
-
s.add_dependency(%q<byebug>, ["~>
|
101
|
+
s.add_dependency(%q<byebug>, ["~> 8.2"])
|
102
102
|
s.add_dependency(%q<github_changelog_generator>, ["~> 1.4"])
|
103
103
|
end
|
104
104
|
end
|
data/spec/megahal_spec.rb
CHANGED
@@ -20,22 +20,24 @@ describe MegaHAL do
|
|
20
20
|
|
21
21
|
describe "#clear" do
|
22
22
|
it "clears all internal state" do
|
23
|
-
expect(megahal.instance_variables.length).to eq(
|
23
|
+
expect(megahal.instance_variables.length).to eq(8)
|
24
24
|
megahal.clear
|
25
25
|
megahal.reply("one two three four five")
|
26
26
|
expect(megahal.instance_variable_get(:@dictionary).length).to eq(15)
|
27
|
-
expect(megahal.instance_variable_get(:@
|
28
|
-
expect(megahal.instance_variable_get(:@
|
29
|
-
expect(megahal.instance_variable_get(:@
|
30
|
-
expect(megahal.instance_variable_get(:@
|
31
|
-
expect(megahal.instance_variable_get(:@
|
27
|
+
expect(megahal.instance_variable_get(:@brain).length).to eq(33)
|
28
|
+
expect(megahal.instance_variable_get(:@seed).count(1)).to be > 0
|
29
|
+
expect(megahal.instance_variable_get(:@fore).count(0)).to be > 0
|
30
|
+
expect(megahal.instance_variable_get(:@back).count(0)).to be > 0
|
31
|
+
expect(megahal.instance_variable_get(:@case).count(13)).to be > 0
|
32
|
+
expect(megahal.instance_variable_get(:@punc).count(27)).to be > 0
|
32
33
|
megahal.clear
|
33
34
|
expect(megahal.instance_variable_get(:@dictionary).length).to eq(3)
|
34
|
-
expect(megahal.instance_variable_get(:@
|
35
|
-
expect(megahal.instance_variable_get(:@
|
36
|
-
expect(megahal.instance_variable_get(:@
|
37
|
-
expect(megahal.instance_variable_get(:@
|
38
|
-
expect(megahal.instance_variable_get(:@
|
35
|
+
expect(megahal.instance_variable_get(:@brain).length).to eq(0)
|
36
|
+
expect(megahal.instance_variable_get(:@seed).count(1)).to eq(0)
|
37
|
+
expect(megahal.instance_variable_get(:@fore).count(0)).to eq(0)
|
38
|
+
expect(megahal.instance_variable_get(:@back).count(0)).to eq(0)
|
39
|
+
expect(megahal.instance_variable_get(:@case).count(13)).to eq(0)
|
40
|
+
expect(megahal.instance_variable_get(:@punc).count(27)).to eq(0)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: megahal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Hutchens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sooth
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: highline
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -170,14 +170,14 @@ dependencies:
|
|
170
170
|
requirements:
|
171
171
|
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
173
|
+
version: '8.2'
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
180
|
+
version: '8.2'
|
181
181
|
- !ruby/object:Gem::Dependency
|
182
182
|
name: github_changelog_generator
|
183
183
|
requirement: !ruby/object:Gem::Requirement
|