chatterbot 2.0.2 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/ci.yml +19 -0
  3. data/Gemfile +9 -17
  4. data/README.markdown +10 -23
  5. data/Rakefile +2 -18
  6. data/chatterbot.gemspec +17 -12
  7. data/docs/Gemfile +3 -0
  8. data/docs/README.md +3 -0
  9. data/docs/_config.yml +37 -0
  10. data/docs/_includes/footer.html +3 -0
  11. data/docs/_includes/header.html +4 -0
  12. data/docs/_includes/navigation.html +23 -0
  13. data/docs/_layouts/default.html +98 -0
  14. data/docs/_layouts/page.html +11 -0
  15. data/docs/_posts/.gitkeep +0 -0
  16. data/docs/_site/Gemfile +3 -0
  17. data/docs/_site/advanced.html +465 -0
  18. data/docs/_site/configuration.html +436 -0
  19. data/docs/_site/contributing.html +414 -0
  20. data/docs/_site/css/main.css +58 -0
  21. data/docs/_site/css/syntax.css +61 -0
  22. data/docs/_site/deploying.html +451 -0
  23. data/docs/_site/examples.html +559 -0
  24. data/docs/_site/features.html +496 -0
  25. data/docs/_site/images/01-create-application.png +0 -0
  26. data/docs/_site/images/02-application-permissions.png +0 -0
  27. data/docs/_site/images/03-mobile-number.png +0 -0
  28. data/docs/_site/images/04-access-token.png +0 -0
  29. data/docs/_site/index.html +461 -0
  30. data/docs/_site/javascripts/main.js +1 -0
  31. data/docs/_site/other-tools.html +419 -0
  32. data/docs/_site/params.json +1 -0
  33. data/docs/_site/rdoc.html +409 -0
  34. data/docs/_site/setup.html +491 -0
  35. data/docs/_site/stylesheets/pygment_trac.css +68 -0
  36. data/docs/_site/stylesheets/stylesheet.css +247 -0
  37. data/docs/_site/tut.html +402 -0
  38. data/docs/_site/twitter-docs.html +409 -0
  39. data/docs/_site/walkthrough.html +447 -0
  40. data/docs/advanced.md +62 -0
  41. data/docs/basics.md +12 -0
  42. data/docs/bin/jekyll-page +109 -0
  43. data/docs/configuration.md +32 -0
  44. data/docs/contributing.md +14 -0
  45. data/docs/css/main.css +58 -0
  46. data/docs/css/syntax.css +61 -0
  47. data/docs/deploying.md +47 -0
  48. data/docs/examples.md +120 -0
  49. data/docs/features.md +88 -0
  50. data/docs/images/01-create-application.png +0 -0
  51. data/docs/images/02-application-permissions.png +0 -0
  52. data/docs/images/03-mobile-number.png +0 -0
  53. data/docs/images/04-access-token.png +0 -0
  54. data/docs/index.md +69 -0
  55. data/docs/javascripts/main.js +1 -0
  56. data/docs/other-tools.md +17 -0
  57. data/docs/params.json +1 -0
  58. data/docs/rdoc.md +6 -0
  59. data/docs/setup.md +84 -0
  60. data/docs/stylesheets/pygment_trac.css +68 -0
  61. data/docs/stylesheets/stylesheet.css +247 -0
  62. data/docs/tips.md +22 -0
  63. data/docs/tut.md +6 -0
  64. data/docs/twitter-docs.md +6 -0
  65. data/docs/walkthrough.md +46 -0
  66. data/lib/chatterbot.rb +0 -1
  67. data/lib/chatterbot/bot.rb +7 -67
  68. data/lib/chatterbot/client.rb +2 -9
  69. data/lib/chatterbot/config.rb +1 -2
  70. data/lib/chatterbot/dsl.rb +20 -47
  71. data/lib/chatterbot/home_timeline.rb +1 -1
  72. data/lib/chatterbot/search.rb +26 -3
  73. data/lib/chatterbot/skeleton.rb +0 -2
  74. data/lib/chatterbot/tweet.rb +13 -3
  75. data/lib/chatterbot/ui.rb +0 -1
  76. data/lib/chatterbot/version.rb +1 -1
  77. data/spec/bot_spec.rb +1 -76
  78. data/spec/client_spec.rb +0 -3
  79. data/spec/config_manager_spec.rb +6 -5
  80. data/spec/config_spec.rb +4 -1
  81. data/spec/dsl_spec.rb +10 -35
  82. data/spec/fixtures/update_with_media.png +0 -0
  83. data/spec/search_spec.rb +40 -1
  84. data/spec/spec_helper.rb +1 -4
  85. data/spec/tweet_spec.rb +74 -34
  86. data/templates/skeleton.txt +0 -47
  87. metadata +81 -135
  88. data/.document +0 -5
  89. data/.travis.yml +0 -11
  90. data/examples/streaming_bot.rb +0 -48
  91. data/examples/tweet_logger.rb +0 -68
  92. data/lib/chatterbot/streaming.rb +0 -62
  93. data/spec/streaming_spec.rb +0 -172
@@ -0,0 +1,409 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta name="viewport" content="width=device-width">
7
+
8
+ <title>chatterbot : Twitter API docs</title>
9
+ <meta name="description" content="twitter bots in ruby">
10
+
11
+ <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
12
+ <link rel="stylesheet" href="/chatterbot/css/syntax.css">
13
+ <link rel="stylesheet" href="/chatterbot/css/main.css">
14
+ </head>
15
+ <body>
16
+
17
+ <div class="container">
18
+ <div class=row-fluid>
19
+ <div id=header class=span12>
20
+ <h4><a class=brand href="/chatterbot/">chatterbot</a>
21
+ <small>twitter bots in ruby</small>
22
+ </h4>
23
+
24
+
25
+ </div>
26
+ </div>
27
+
28
+ <div class=row-fluid>
29
+
30
+
31
+ <div id=navigation class=span2>
32
+ <ul class="nav nav-list">
33
+ <li><a href="/chatterbot/">Home</a></li>
34
+
35
+
36
+
37
+ <li class=nav-header>Getting Started</li>
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ <li data-order="">
58
+
59
+ <a href="/chatterbot/examples.html">Examples</a>
60
+
61
+ </li>
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+ <li data-order="">
84
+
85
+ <a href="/chatterbot/setup.html">Authorizing Your Bot</a>
86
+
87
+ </li>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <li data-order="">
102
+
103
+ <a href="/chatterbot/walkthrough.html">Walkthrough</a>
104
+
105
+ </li>
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <li class=nav-header>Documentation</li>
113
+
114
+
115
+
116
+ <li data-order="">
117
+
118
+ <a href="/chatterbot/advanced.html">Advanced Features</a>
119
+
120
+ </li>
121
+
122
+
123
+
124
+
125
+
126
+ <li data-order="">
127
+
128
+ <a href="/chatterbot/configuration.html">Configuration</a>
129
+
130
+ </li>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <li data-order="">
141
+
142
+ <a href="/chatterbot/deploying.html">Running your Bot</a>
143
+
144
+ </li>
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ <li data-order="">
155
+
156
+ <a href="/chatterbot/features.html">Basic Features</a>
157
+
158
+ </li>
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <li class=nav-header>Developers</li>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <li data-order="">
206
+
207
+ <a href="/chatterbot/contributing.html">Contributing</a>
208
+
209
+ </li>
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <li class=nav-header>Resources</li>
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+ <li data-order="">
289
+
290
+ <a href="/chatterbot/other-tools.html">Other Tools</a>
291
+
292
+ </li>
293
+
294
+
295
+
296
+
297
+
298
+ <li data-order="">
299
+
300
+ <a href="http://rubydoc.info/gems/chatterbot">rdoc</a>
301
+
302
+ </li>
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <li data-order="">
317
+
318
+ <a href="https://dev.twitter.com/rest/public">Twitter API docs</a>
319
+
320
+ </li>
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ <!-- List additional links. It is recommended to add a divider
330
+ e.g. <li class=divider></li> first to break up the content. -->
331
+ </ul>
332
+
333
+ </div>
334
+
335
+ <div id=content class=span10>
336
+ <div class=page-header>
337
+ <h2>Twitter API docs
338
+
339
+ </h2>
340
+ </div>
341
+
342
+
343
+
344
+
345
+ </div>
346
+
347
+ </div>
348
+
349
+ <div class=row-fluid>
350
+ <div id=footer class=span12>
351
+ <!--
352
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
353
+ -->
354
+
355
+ </div>
356
+ </div>
357
+ </div>
358
+
359
+ <script>
360
+ function orderNav() {
361
+ var list,
362
+ section,
363
+ header,
364
+ sections = [],
365
+ lists = {},
366
+ headers = {};
367
+
368
+ var navUl = document.querySelectorAll('#navigation ul')[0],
369
+ navLis = document.querySelectorAll('#navigation ul li');
370
+
371
+ if (!navUl) return;
372
+
373
+ for (var i = 0; i < navLis.length; i++) {
374
+ var order, li = navLis[i];
375
+
376
+ if (li.classList.contains('nav-header')) {
377
+ section = li.textContent || li.innerText;
378
+ sections.push(section);
379
+ headers[section] = li;
380
+ continue;
381
+ }
382
+
383
+ if (!lists[section]) {
384
+ lists[section] = [];
385
+ }
386
+
387
+ order = parseFloat(li.getAttribute('data-order'))
388
+ lists[section].push([order, li]);
389
+ }
390
+
391
+ for (var i = 0; i < sections.length; i++) {
392
+ section = sections[i];
393
+ list = lists[section].sort(function(a, b) {
394
+ return a[0] - b[0];
395
+ });
396
+
397
+ if (header = headers[section]) {
398
+ navUl.appendChild(header);
399
+ }
400
+ for (var j = 0; j < list.length; j++) {
401
+ navUl.appendChild(list[j][1]);
402
+ }
403
+ }
404
+ }
405
+
406
+ if (document.querySelectorAll) orderNav();
407
+ </script>
408
+ </body>
409
+ </html>
@@ -0,0 +1,447 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
6
+ <meta name="viewport" content="width=device-width">
7
+
8
+ <title>chatterbot : Walkthrough</title>
9
+ <meta name="description" content="twitter bots in ruby">
10
+
11
+ <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">
12
+ <link rel="stylesheet" href="/chatterbot/css/syntax.css">
13
+ <link rel="stylesheet" href="/chatterbot/css/main.css">
14
+ </head>
15
+ <body>
16
+
17
+ <div class="container">
18
+ <div class=row-fluid>
19
+ <div id=header class=span12>
20
+ <h4><a class=brand href="/chatterbot/">chatterbot</a>
21
+ <small>twitter bots in ruby</small>
22
+ </h4>
23
+
24
+
25
+ </div>
26
+ </div>
27
+
28
+ <div class=row-fluid>
29
+
30
+
31
+ <div id=navigation class=span2>
32
+ <ul class="nav nav-list">
33
+ <li><a href="/chatterbot/">Home</a></li>
34
+
35
+
36
+
37
+ <li class=nav-header>Getting Started</li>
38
+
39
+
40
+
41
+
42
+
43
+
44
+
45
+
46
+
47
+
48
+
49
+
50
+
51
+
52
+
53
+
54
+
55
+
56
+
57
+ <li data-order="">
58
+
59
+ <a href="/chatterbot/examples.html">Examples</a>
60
+
61
+ </li>
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
83
+ <li data-order="">
84
+
85
+ <a href="/chatterbot/setup.html">Authorizing Your Bot</a>
86
+
87
+ </li>
88
+
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+ <li data-order="">
102
+
103
+ <a href="/chatterbot/walkthrough.html">Walkthrough</a>
104
+
105
+ </li>
106
+
107
+
108
+
109
+
110
+
111
+
112
+ <li class=nav-header>Documentation</li>
113
+
114
+
115
+
116
+ <li data-order="">
117
+
118
+ <a href="/chatterbot/advanced.html">Advanced Features</a>
119
+
120
+ </li>
121
+
122
+
123
+
124
+
125
+
126
+ <li data-order="">
127
+
128
+ <a href="/chatterbot/configuration.html">Configuration</a>
129
+
130
+ </li>
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+ <li data-order="">
141
+
142
+ <a href="/chatterbot/deploying.html">Running your Bot</a>
143
+
144
+ </li>
145
+
146
+
147
+
148
+
149
+
150
+
151
+
152
+
153
+
154
+ <li data-order="">
155
+
156
+ <a href="/chatterbot/features.html">Basic Features</a>
157
+
158
+ </li>
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+
175
+
176
+
177
+
178
+
179
+
180
+
181
+
182
+
183
+
184
+
185
+
186
+
187
+
188
+
189
+
190
+
191
+
192
+
193
+ <li class=nav-header>Developers</li>
194
+
195
+
196
+
197
+
198
+
199
+
200
+
201
+
202
+
203
+
204
+
205
+ <li data-order="">
206
+
207
+ <a href="/chatterbot/contributing.html">Contributing</a>
208
+
209
+ </li>
210
+
211
+
212
+
213
+
214
+
215
+
216
+
217
+
218
+
219
+
220
+
221
+
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+
253
+
254
+
255
+
256
+ <li class=nav-header>Resources</li>
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+
276
+
277
+
278
+
279
+
280
+
281
+
282
+
283
+
284
+
285
+
286
+
287
+
288
+ <li data-order="">
289
+
290
+ <a href="/chatterbot/other-tools.html">Other Tools</a>
291
+
292
+ </li>
293
+
294
+
295
+
296
+
297
+
298
+ <li data-order="">
299
+
300
+ <a href="http://rubydoc.info/gems/chatterbot">rdoc</a>
301
+
302
+ </li>
303
+
304
+
305
+
306
+
307
+
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+ <li data-order="">
317
+
318
+ <a href="https://dev.twitter.com/rest/public">Twitter API docs</a>
319
+
320
+ </li>
321
+
322
+
323
+
324
+
325
+
326
+
327
+
328
+
329
+ <!-- List additional links. It is recommended to add a divider
330
+ e.g. <li class=divider></li> first to break up the content. -->
331
+ </ul>
332
+
333
+ </div>
334
+
335
+ <div id=content class=span10>
336
+ <div class=page-header>
337
+ <h2>Walkthrough
338
+
339
+ </h2>
340
+ </div>
341
+
342
+ <h2 id="make-a-twitter-account">Make a Twitter account</h2>
343
+
344
+ <p>First thing you’ll need to do is create an account for your bot on
345
+ Twitter. That’s the easy part.</p>
346
+
347
+ <h2 id="run-the-generator">Run the generator</h2>
348
+
349
+ <p>Chatterbot comes with a script named <code>chatterbot-register</code> which will
350
+ handle two tasks – it will authorize your bot with Twitter and it
351
+ will generate a skeleton script, which you use to implement your
352
+ actual bot.</p>
353
+
354
+ <p>When you run <code>chatterbot-register</code> it will walk you through the
355
+ authorization process. If you prefer, you can do this manually. If
356
+ you’d like to learn more about it, you can read the
357
+ <a href="setup.html">Authorizing your Bot</a> section.</p>
358
+
359
+ <h2 id="write-your-bot">Write your bot</h2>
360
+
361
+ <p>Chatterbot is written in ruby, but it accepts some very simple
362
+ scripting commands which can handle almost everything you might need
363
+ to do on Twitter. You can get some ideas of things you can do on the
364
+ <a href="examples.html">Examples</a> page.</p>
365
+
366
+ <pre><code>require 'chatterbot/dsl'
367
+ search("'surely you must be joking'") do |tweet|
368
+ reply "@#{tweet_user(tweet)} I am serious, and don't call me Shirley!", tweet
369
+ end
370
+ </code></pre>
371
+
372
+ <p>Or, you can create a bot object yourself, extend it if needed, and use it like so:</p>
373
+
374
+ <pre><code>bot = Chatterbot::Bot.new
375
+ bot.search("'surely you must be joking'") do |tweet|
376
+ bot.reply "@#{tweet_user(tweet)} I am serious, and don't call me Shirley!", tweet
377
+ end
378
+ </code></pre>
379
+
380
+ <p>That’s it!</p>
381
+
382
+
383
+ </div>
384
+
385
+ </div>
386
+
387
+ <div class=row-fluid>
388
+ <div id=footer class=span12>
389
+ <!--
390
+ Documentation for <a href="https://github.com/muffinista/chatterbot">chatterbot</a>
391
+ -->
392
+
393
+ </div>
394
+ </div>
395
+ </div>
396
+
397
+ <script>
398
+ function orderNav() {
399
+ var list,
400
+ section,
401
+ header,
402
+ sections = [],
403
+ lists = {},
404
+ headers = {};
405
+
406
+ var navUl = document.querySelectorAll('#navigation ul')[0],
407
+ navLis = document.querySelectorAll('#navigation ul li');
408
+
409
+ if (!navUl) return;
410
+
411
+ for (var i = 0; i < navLis.length; i++) {
412
+ var order, li = navLis[i];
413
+
414
+ if (li.classList.contains('nav-header')) {
415
+ section = li.textContent || li.innerText;
416
+ sections.push(section);
417
+ headers[section] = li;
418
+ continue;
419
+ }
420
+
421
+ if (!lists[section]) {
422
+ lists[section] = [];
423
+ }
424
+
425
+ order = parseFloat(li.getAttribute('data-order'))
426
+ lists[section].push([order, li]);
427
+ }
428
+
429
+ for (var i = 0; i < sections.length; i++) {
430
+ section = sections[i];
431
+ list = lists[section].sort(function(a, b) {
432
+ return a[0] - b[0];
433
+ });
434
+
435
+ if (header = headers[section]) {
436
+ navUl.appendChild(header);
437
+ }
438
+ for (var j = 0; j < list.length; j++) {
439
+ navUl.appendChild(list[j][1]);
440
+ }
441
+ }
442
+ }
443
+
444
+ if (document.querySelectorAll) orderNav();
445
+ </script>
446
+ </body>
447
+ </html>