marky_markov 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,415 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Class: MarkyMarkov::Dictionary
8
-
9
- &mdash; Documentation by YARD 0.7.5
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '..';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="../_index.html">Index (D)</a> &raquo;
37
- <span class='title'><span class='object_link'><a href="../MarkyMarkov.html" title="MarkyMarkov (module)">MarkyMarkov</a></span></span>
38
- &raquo;
39
- <span class="title">Dictionary</span>
40
-
41
-
42
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
- </div>
44
-
45
- <div id="search">
46
-
47
- <a id="class_list_link" href="#">Class List</a>
48
-
49
- <a id="method_list_link" href="#">Method List</a>
50
-
51
- <a id="file_list_link" href="#">File List</a>
52
-
53
- </div>
54
- <div class="clear"></div>
55
- </div>
56
-
57
- <iframe id="search_frame"></iframe>
58
-
59
- <div id="content"><h1>Class: MarkyMarkov::Dictionary
60
-
61
-
62
-
63
- </h1>
64
-
65
- <dl class="box">
66
-
67
- <dt class="r1">Inherits:</dt>
68
- <dd class="r1">
69
- <span class="inheritName"><span class='object_link'><a href="TemporaryDictionary.html" title="MarkyMarkov::TemporaryDictionary (class)">TemporaryDictionary</a></span></span>
70
-
71
- <ul class="fullTree">
72
- <li>Object</li>
73
-
74
- <li class="next"><span class='object_link'><a href="TemporaryDictionary.html" title="MarkyMarkov::TemporaryDictionary (class)">TemporaryDictionary</a></span></li>
75
-
76
- <li class="next">MarkyMarkov::Dictionary</li>
77
-
78
- </ul>
79
- <a href="#" class="inheritanceTree">show all</a>
80
-
81
- </dd>
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
-
90
-
91
- <dt class="r2 last">Defined in:</dt>
92
- <dd class="r2 last">lib/marky_markov.rb</dd>
93
-
94
- </dl>
95
- <div class="clear"></div>
96
-
97
-
98
-
99
-
100
-
101
-
102
-
103
-
104
-
105
- <h2>
106
- Class Method Summary
107
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
108
- </h2>
109
-
110
- <ul class="summary">
111
-
112
- <li class="public ">
113
- <span class="summary_signature">
114
-
115
- <a href="#delete_dictionary%21-class_method" title="delete_dictionary! (class method)">+ (Object) <strong>delete_dictionary!</strong>(location) </a>
116
-
117
-
118
-
119
- </span>
120
-
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
- <span class="summary_desc"><div class='inline'>
129
- <p>Class Method: Takes a dictionary location/name and deletes it from the
130
- file-system.</p>
131
- </div></span>
132
-
133
- </li>
134
-
135
-
136
- </ul>
137
-
138
- <h2>
139
- Instance Method Summary
140
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
141
- </h2>
142
-
143
- <ul class="summary">
144
-
145
- <li class="public ">
146
- <span class="summary_signature">
147
-
148
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Dictionary) <strong>initialize</strong>(location) </a>
149
-
150
-
151
-
152
- </span>
153
-
154
- <span class="note title constructor">constructor</span>
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
- <span class="summary_desc"><div class='inline'>
164
- <p>Open (or create if it doesn't exist) a Persistent Markov Chain Dictionary
165
- and sentence generator for use.</p>
166
- </div></span>
167
-
168
- </li>
169
-
170
-
171
- <li class="public ">
172
- <span class="summary_signature">
173
-
174
- <a href="#save_dictionary%21-instance_method" title="#save_dictionary! (instance method)">- (Object) <strong>save_dictionary!</strong> </a>
175
-
176
-
177
-
178
- </span>
179
-
180
-
181
-
182
-
183
-
184
-
185
-
186
-
187
- <span class="summary_desc"><div class='inline'>
188
- <p>Save the Persistent Dictionary file into JSON format for later use.</p>
189
- </div></span>
190
-
191
- </li>
192
-
193
-
194
- </ul>
195
-
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
-
205
- <h3 class="inherited">Methods inherited from <span class='object_link'><a href="TemporaryDictionary.html" title="MarkyMarkov::TemporaryDictionary (class)">TemporaryDictionary</a></span></h3>
206
- <p class="inherited"><span class='object_link'><a href="TemporaryDictionary.html#clear%21-instance_method" title="MarkyMarkov::TemporaryDictionary#clear! (method)">#clear!</a></span>, <span class='object_link'><a href="TemporaryDictionary.html#generate_n_words-instance_method" title="MarkyMarkov::TemporaryDictionary#generate_n_words (method)">#generate_n_words</a></span>, <span class='object_link'><a href="TemporaryDictionary.html#parse_file-instance_method" title="MarkyMarkov::TemporaryDictionary#parse_file (method)">#parse_file</a></span>, <span class='object_link'><a href="TemporaryDictionary.html#parse_string-instance_method" title="MarkyMarkov::TemporaryDictionary#parse_string (method)">#parse_string</a></span></p>
207
- <div id="constructor_details" class="method_details_list">
208
- <h2>Constructor Details</h2>
209
-
210
- <div class="method_details first">
211
- <p class="signature first" id="initialize-instance_method">
212
-
213
- - (<tt><span class='object_link'><a href="" title="MarkyMarkov::Dictionary (class)">Dictionary</a></span></tt>) <strong>initialize</strong>(location)
214
-
215
-
216
-
217
- </p><div class="docstring">
218
- <div class="discussion">
219
-
220
- <p>Open (or create if it doesn't exist) a Persistent Markov Chain Dictionary
221
- and sentence generator for use.</p>
222
-
223
-
224
- </div>
225
- </div>
226
- <div class="tags">
227
-
228
- <div class="examples">
229
- <h3>Examples:</h3>
230
-
231
- <h4><div class='inline'>
232
- <p>Create a new Persistent Dictionary object.</p>
233
- </div></h4>
234
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span> <span class='op'>=</span> <span class='const'>MarkyMarkov</span><span class='op'>::</span><span class='const'>Dictionary</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HOME</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>/markov_dictionary</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></pre>
235
-
236
- </div>
237
-
238
-
239
- </div><table class="source_code">
240
- <tr>
241
- <td>
242
- <pre class="lines">
243
-
244
-
245
- 66
246
- 67
247
- 68
248
- 69</pre>
249
- </td>
250
- <td>
251
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 66</span>
252
-
253
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
254
- <span class='ivar'>@dictionary</span> <span class='op'>=</span> <span class='const'>PersistentDictionary</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
255
- <span class='ivar'>@sentence</span> <span class='op'>=</span> <span class='const'>TwoWordSentenceGenerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@dictionary</span><span class='rparen'>)</span>
256
- <span class='kw'>end</span></pre>
257
- </td>
258
- </tr>
259
- </table>
260
- </div>
261
-
262
- </div>
263
-
264
-
265
- <div id="class_method_details" class="method_details_list">
266
- <h2>Class Method Details</h2>
267
-
268
-
269
- <div class="method_details first">
270
- <p class="signature first" id="delete_dictionary!-class_method">
271
-
272
- + (<tt>Object</tt>) <strong>delete_dictionary!</strong>(location)
273
-
274
-
275
-
276
- </p><div class="docstring">
277
- <div class="discussion">
278
-
279
- <div class="note notetag">
280
- <strong>Note:</strong>
281
- <div class='inline'>
282
- <p>To ensure that someone doesn't pass in something that shouldn't be deleted
283
- by accident, the filetype .mmd is added to the end of the supplied
284
- arguement, so do not include the extension when calling the method.</p>
285
- </div>
286
- </div>
287
-
288
-
289
- <p>Class Method: Takes a dictionary location/name and deletes it from the
290
- file-system.</p>
291
-
292
-
293
- </div>
294
- </div>
295
- <div class="tags">
296
-
297
- <div class="examples">
298
- <h3>Examples:</h3>
299
-
300
- <h4><div class='inline'>
301
- <p>Delete the dictionary located at '~/markov_dictionary.mmd'</p>
302
- </div></h4>
303
- <pre class="example code"><span class='const'>MarkyMarkov</span><span class='op'>::</span><span class='const'>Dictionary</span><span class='period'>.</span><span class='id identifier rubyid_delete_dictionary!'>delete_dictionary!</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='embexpr_beg'>#{</span><span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>HOME</span><span class='tstring_end'>&quot;</span></span><span class='rbracket'>]</span><span class='rbrace'>}</span><span class='tstring_content'>/markov_dictionary</span><span class='tstring_end'>&quot;</span></span><span class='rparen'>)</span></pre>
304
-
305
- </div>
306
- <h3>Parameters:</h3>
307
- <ul class="param">
308
-
309
- <li>
310
-
311
- <span class='name'>location</span>
312
-
313
-
314
- <span class='type'>(<tt>String</tt>)</span>
315
-
316
-
317
-
318
- &mdash;
319
- <div class='inline'>
320
- <p>location/name of the dictionary file to be deleted.</p>
321
- </div>
322
-
323
- </li>
324
-
325
- </ul>
326
-
327
-
328
- </div><table class="source_code">
329
- <tr>
330
- <td>
331
- <pre class="lines">
332
-
333
-
334
- 88
335
- 89
336
- 90</pre>
337
- </td>
338
- <td>
339
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 88</span>
340
-
341
- <span class='kw'>def</span> <span class='kw'>self</span><span class='period'>.</span><span class='id identifier rubyid_delete_dictionary!'>delete_dictionary!</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
342
- <span class='const'>PersistentDictionary</span><span class='period'>.</span><span class='id identifier rubyid_delete_dictionary!'>delete_dictionary!</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
343
- <span class='kw'>end</span></pre>
344
- </td>
345
- </tr>
346
- </table>
347
- </div>
348
-
349
- </div>
350
-
351
- <div id="instance_method_details" class="method_details_list">
352
- <h2>Instance Method Details</h2>
353
-
354
-
355
- <div class="method_details first">
356
- <p class="signature first" id="save_dictionary!-instance_method">
357
-
358
- - (<tt>Object</tt>) <strong>save_dictionary!</strong>
359
-
360
-
361
-
362
- </p><div class="docstring">
363
- <div class="discussion">
364
-
365
- <p>Save the Persistent Dictionary file into JSON format for later use.</p>
366
-
367
-
368
- </div>
369
- </div>
370
- <div class="tags">
371
-
372
- <div class="examples">
373
- <h3>Examples:</h3>
374
-
375
- <h4><div class='inline'>
376
- <p>Save the dictionary to disk.</p>
377
- </div></h4>
378
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span><span class='period'>.</span><span class='id identifier rubyid_save_dictionary!'>save_dictionary!</span></pre>
379
-
380
- </div>
381
-
382
-
383
- </div><table class="source_code">
384
- <tr>
385
- <td>
386
- <pre class="lines">
387
-
388
-
389
- 75
390
- 76
391
- 77</pre>
392
- </td>
393
- <td>
394
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 75</span>
395
-
396
- <span class='kw'>def</span> <span class='id identifier rubyid_save_dictionary!'>save_dictionary!</span>
397
- <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_save_dictionary!'>save_dictionary!</span>
398
- <span class='kw'>end</span></pre>
399
- </td>
400
- </tr>
401
- </table>
402
- </div>
403
-
404
- </div>
405
-
406
- </div>
407
-
408
- <div id="footer">
409
- Generated on Mon Feb 6 22:18:54 2012 by
410
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
411
- 0.7.5 (ruby-1.9.3).
412
- </div>
413
-
414
- </body>
415
- </html>
@@ -1,588 +0,0 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
- <head>
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6
- <title>
7
- Class: MarkyMarkov::TemporaryDictionary
8
-
9
- &mdash; Documentation by YARD 0.7.5
10
-
11
- </title>
12
-
13
- <link rel="stylesheet" href="../css/style.css" type="text/css" media="screen" charset="utf-8" />
14
-
15
- <link rel="stylesheet" href="../css/common.css" type="text/css" media="screen" charset="utf-8" />
16
-
17
- <script type="text/javascript" charset="utf-8">
18
- relpath = '..';
19
- if (relpath != '') relpath += '/';
20
- </script>
21
-
22
- <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
23
-
24
- <script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
25
-
26
-
27
- </head>
28
- <body>
29
- <script type="text/javascript" charset="utf-8">
30
- if (window.top.frames.main) document.body.className = 'frames';
31
- </script>
32
-
33
- <div id="header">
34
- <div id="menu">
35
-
36
- <a href="../_index.html">Index (T)</a> &raquo;
37
- <span class='title'><span class='object_link'><a href="../MarkyMarkov.html" title="MarkyMarkov (module)">MarkyMarkov</a></span></span>
38
- &raquo;
39
- <span class="title">TemporaryDictionary</span>
40
-
41
-
42
- <div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
43
- </div>
44
-
45
- <div id="search">
46
-
47
- <a id="class_list_link" href="#">Class List</a>
48
-
49
- <a id="method_list_link" href="#">Method List</a>
50
-
51
- <a id="file_list_link" href="#">File List</a>
52
-
53
- </div>
54
- <div class="clear"></div>
55
- </div>
56
-
57
- <iframe id="search_frame"></iframe>
58
-
59
- <div id="content"><h1>Class: MarkyMarkov::TemporaryDictionary
60
-
61
-
62
-
63
- </h1>
64
-
65
- <dl class="box">
66
-
67
- <dt class="r1">Inherits:</dt>
68
- <dd class="r1">
69
- <span class="inheritName">Object</span>
70
-
71
- <ul class="fullTree">
72
- <li>Object</li>
73
-
74
- <li class="next">MarkyMarkov::TemporaryDictionary</li>
75
-
76
- </ul>
77
- <a href="#" class="inheritanceTree">show all</a>
78
-
79
- </dd>
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
-
89
- <dt class="r2 last">Defined in:</dt>
90
- <dd class="r2 last">lib/marky_markov.rb</dd>
91
-
92
- </dl>
93
- <div class="clear"></div>
94
-
95
- <div id="subclasses">
96
- <h2>Direct Known Subclasses</h2>
97
- <p class="children"><span class='object_link'><a href="Dictionary.html" title="MarkyMarkov::Dictionary (class)">Dictionary</a></span></p>
98
- </div>
99
-
100
-
101
-
102
-
103
-
104
-
105
-
106
-
107
- <h2>
108
- Instance Method Summary
109
- <small>(<a href="#" class="summary_toggle">collapse</a>)</small>
110
- </h2>
111
-
112
- <ul class="summary">
113
-
114
- <li class="public ">
115
- <span class="summary_signature">
116
-
117
- <a href="#clear%21-instance_method" title="#clear! (instance method)">- (Object) <strong>clear!</strong> </a>
118
-
119
-
120
-
121
- </span>
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
- <span class="summary_desc"><div class='inline'>
131
- <p>Clears the temporary dictionary's hash, useful for keeping the same
132
- dictionary object but removing the words it has learned.</p>
133
- </div></span>
134
-
135
- </li>
136
-
137
-
138
- <li class="public ">
139
- <span class="summary_signature">
140
-
141
- <a href="#generate_n_words-instance_method" title="#generate_n_words (instance method)">- (String) <strong>generate_n_words</strong>(wordcount) </a>
142
-
143
-
144
-
145
- </span>
146
-
147
-
148
-
149
-
150
-
151
-
152
-
153
-
154
- <span class="summary_desc"><div class='inline'>
155
- <p>Generates a sentence/sentences of n words using the dictionary generated
156
- via parse_string or parse_file.</p>
157
- </div></span>
158
-
159
- </li>
160
-
161
-
162
- <li class="public ">
163
- <span class="summary_signature">
164
-
165
- <a href="#initialize-instance_method" title="#initialize (instance method)">- (Object) <strong>initialize</strong> </a>
166
-
167
-
168
-
169
- </span>
170
-
171
- <span class="note title constructor">constructor</span>
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
-
180
- <span class="summary_desc"><div class='inline'>
181
- <p>Create a new Temporary Markov Chain Dictionary and sentence generator for
182
- use.</p>
183
- </div></span>
184
-
185
- </li>
186
-
187
-
188
- <li class="public ">
189
- <span class="summary_signature">
190
-
191
- <a href="#parse_file-instance_method" title="#parse_file (instance method)">- (Object) <strong>parse_file</strong>(location) </a>
192
-
193
-
194
-
195
- </span>
196
-
197
-
198
-
199
-
200
-
201
-
202
-
203
-
204
- <span class="summary_desc"><div class='inline'>
205
- <p>Parses a given file and adds the sentences it contains to the current
206
- dictionary.</p>
207
- </div></span>
208
-
209
- </li>
210
-
211
-
212
- <li class="public ">
213
- <span class="summary_signature">
214
-
215
- <a href="#parse_string-instance_method" title="#parse_string (instance method)">- (Object) <strong>parse_string</strong>(string) </a>
216
-
217
-
218
-
219
- </span>
220
-
221
-
222
-
223
-
224
-
225
-
226
-
227
-
228
- <span class="summary_desc"><div class='inline'>
229
- <p>Parses a given string and adds them to the current dictionary.</p>
230
- </div></span>
231
-
232
- </li>
233
-
234
-
235
- </ul>
236
-
237
-
238
- <div id="constructor_details" class="method_details_list">
239
- <h2>Constructor Details</h2>
240
-
241
- <div class="method_details first">
242
- <p class="signature first" id="initialize-instance_method">
243
-
244
- - (<tt>Object</tt>) <strong>initialize</strong>
245
-
246
-
247
-
248
- </p><div class="docstring">
249
- <div class="discussion">
250
-
251
- <p>Create a new Temporary Markov Chain Dictionary and sentence generator for
252
- use.</p>
253
-
254
-
255
- </div>
256
- </div>
257
- <div class="tags">
258
-
259
- <div class="examples">
260
- <h3>Examples:</h3>
261
-
262
- <h4><div class='inline'>
263
- <p>Create a new Temporary Dictionary.</p>
264
- </div></h4>
265
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span> <span class='op'>=</span> <span class='const'>MarkyMarkov</span><span class='op'>::</span><span class='const'>TemporaryDictionary</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span></pre>
266
-
267
- </div>
268
-
269
-
270
- </div><table class="source_code">
271
- <tr>
272
- <td>
273
- <pre class="lines">
274
-
275
-
276
- 16
277
- 17
278
- 18
279
- 19</pre>
280
- </td>
281
- <td>
282
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 16</span>
283
-
284
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span>
285
- <span class='ivar'>@dictionary</span> <span class='op'>=</span> <span class='const'>TwoWordDictionary</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
286
- <span class='ivar'>@sentence</span> <span class='op'>=</span> <span class='const'>TwoWordSentenceGenerator</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@dictionary</span><span class='rparen'>)</span>
287
- <span class='kw'>end</span></pre>
288
- </td>
289
- </tr>
290
- </table>
291
- </div>
292
-
293
- </div>
294
-
295
-
296
- <div id="instance_method_details" class="method_details_list">
297
- <h2>Instance Method Details</h2>
298
-
299
-
300
- <div class="method_details first">
301
- <p class="signature first" id="clear!-instance_method">
302
-
303
- - (<tt>Object</tt>) <strong>clear!</strong>
304
-
305
-
306
-
307
- </p><div class="docstring">
308
- <div class="discussion">
309
-
310
- <p>Clears the temporary dictionary's hash, useful for keeping the same
311
- dictionary object but removing the words it has learned.</p>
312
-
313
-
314
- </div>
315
- </div>
316
- <div class="tags">
317
-
318
- <div class="examples">
319
- <h3>Examples:</h3>
320
-
321
- <h4><div class='inline'>
322
- <p>Clear the Dictionary hash.</p>
323
- </div></h4>
324
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span><span class='period'>.</span><span class='id identifier rubyid_clear!'>clear!</span></pre>
325
-
326
- </div>
327
-
328
-
329
- </div><table class="source_code">
330
- <tr>
331
- <td>
332
- <pre class="lines">
333
-
334
-
335
- 55
336
- 56
337
- 57</pre>
338
- </td>
339
- <td>
340
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 55</span>
341
-
342
- <span class='kw'>def</span> <span class='id identifier rubyid_clear!'>clear!</span>
343
- <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_dictionary'>dictionary</span><span class='period'>.</span><span class='id identifier rubyid_clear'>clear</span>
344
- <span class='kw'>end</span></pre>
345
- </td>
346
- </tr>
347
- </table>
348
- </div>
349
-
350
- <div class="method_details ">
351
- <p class="signature " id="generate_n_words-instance_method">
352
-
353
- - (<tt>String</tt>) <strong>generate_n_words</strong>(wordcount)
354
-
355
-
356
-
357
- </p><div class="docstring">
358
- <div class="discussion">
359
-
360
- <p>Generates a sentence/sentences of n words using the dictionary generated
361
- via parse_string or parse_file.</p>
362
-
363
-
364
- </div>
365
- </div>
366
- <div class="tags">
367
-
368
- <div class="examples">
369
- <h3>Examples:</h3>
370
-
371
- <h4><div class='inline'>
372
- <p>Generate a 40 word long string of words.</p>
373
- </div></h4>
374
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span><span class='period'>.</span><span class='id identifier rubyid_generate_n_words'>generate_n_words</span><span class='lparen'>(</span><span class='int'>40</span><span class='rparen'>)</span></pre>
375
-
376
- </div>
377
- <h3>Parameters:</h3>
378
- <ul class="param">
379
-
380
- <li>
381
-
382
- <span class='name'>wordcount</span>
383
-
384
-
385
- <span class='type'>(<tt>Int</tt>)</span>
386
-
387
-
388
-
389
- &mdash;
390
- <div class='inline'>
391
- <p>the number of words you want generated.</p>
392
- </div>
393
-
394
- </li>
395
-
396
- </ul>
397
-
398
- <h3>Returns:</h3>
399
- <ul class="return">
400
-
401
- <li>
402
-
403
-
404
- <span class='type'>(<tt>String</tt>)</span>
405
-
406
-
407
-
408
- &mdash;
409
- <div class='inline'>
410
- <p>the sentence generated by the dictionary.</p>
411
- </div>
412
-
413
- </li>
414
-
415
- </ul>
416
-
417
- </div><table class="source_code">
418
- <tr>
419
- <td>
420
- <pre class="lines">
421
-
422
-
423
- 46
424
- 47
425
- 48</pre>
426
- </td>
427
- <td>
428
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 46</span>
429
-
430
- <span class='kw'>def</span> <span class='id identifier rubyid_generate_n_words'>generate_n_words</span><span class='lparen'>(</span><span class='id identifier rubyid_wordcount'>wordcount</span><span class='rparen'>)</span>
431
- <span class='ivar'>@sentence</span><span class='period'>.</span><span class='id identifier rubyid_generate'>generate</span><span class='lparen'>(</span><span class='id identifier rubyid_wordcount'>wordcount</span><span class='rparen'>)</span>
432
- <span class='kw'>end</span></pre>
433
- </td>
434
- </tr>
435
- </table>
436
- </div>
437
-
438
- <div class="method_details ">
439
- <p class="signature " id="parse_file-instance_method">
440
-
441
- - (<tt>Object</tt>) <strong>parse_file</strong>(location)
442
-
443
-
444
-
445
- </p><div class="docstring">
446
- <div class="discussion">
447
-
448
- <p>Parses a given file and adds the sentences it contains to the current
449
- dictionary.</p>
450
-
451
-
452
- </div>
453
- </div>
454
- <div class="tags">
455
-
456
- <div class="examples">
457
- <h3>Examples:</h3>
458
-
459
- <h4><div class='inline'>
460
- <p>Open a text file and add its contents to the dictionary.</p>
461
- </div></h4>
462
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span><span class='period'>.</span><span class='id identifier rubyid_parse_file'>parse_file</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>text.txt</span><span class='tstring_end'>&quot;</span></span></pre>
463
-
464
- </div>
465
- <h3>Parameters:</h3>
466
- <ul class="param">
467
-
468
- <li>
469
-
470
- <span class='name'>location</span>
471
-
472
-
473
- <span class='type'>(<tt>File</tt>)</span>
474
-
475
-
476
-
477
- &mdash;
478
- <div class='inline'>
479
- <p>the file you want to add to the dictionary.</p>
480
- </div>
481
-
482
- </li>
483
-
484
- </ul>
485
-
486
-
487
- </div><table class="source_code">
488
- <tr>
489
- <td>
490
- <pre class="lines">
491
-
492
-
493
- 26
494
- 27
495
- 28</pre>
496
- </td>
497
- <td>
498
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 26</span>
499
-
500
- <span class='kw'>def</span> <span class='id identifier rubyid_parse_file'>parse_file</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='rparen'>)</span>
501
- <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_parse_source'>parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_location'>location</span><span class='comma'>,</span> <span class='kw'>true</span><span class='rparen'>)</span>
502
- <span class='kw'>end</span></pre>
503
- </td>
504
- </tr>
505
- </table>
506
- </div>
507
-
508
- <div class="method_details ">
509
- <p class="signature " id="parse_string-instance_method">
510
-
511
- - (<tt>Object</tt>) <strong>parse_string</strong>(string)
512
-
513
-
514
-
515
- </p><div class="docstring">
516
- <div class="discussion">
517
-
518
- <p>Parses a given string and adds them to the current dictionary.</p>
519
-
520
-
521
- </div>
522
- </div>
523
- <div class="tags">
524
-
525
- <div class="examples">
526
- <h3>Examples:</h3>
527
-
528
- <h4><div class='inline'>
529
- <p>Add a string to the dictionary.</p>
530
- </div></h4>
531
- <pre class="example code"><span class='id identifier rubyid_markov'>markov</span><span class='period'>.</span><span class='id identifier rubyid_parse_string'>parse_string</span> <span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>I could really go for some Chicken Makhani.</span><span class='tstring_end'>&quot;</span></span></pre>
532
-
533
- </div>
534
- <h3>Parameters:</h3>
535
- <ul class="param">
536
-
537
- <li>
538
-
539
- <span class='name'>sentence</span>
540
-
541
-
542
- <span class='type'>(<tt>String</tt>)</span>
543
-
544
-
545
-
546
- &mdash;
547
- <div class='inline'>
548
- <p>the sentence you want to add to the dictionary.</p>
549
- </div>
550
-
551
- </li>
552
-
553
- </ul>
554
-
555
-
556
- </div><table class="source_code">
557
- <tr>
558
- <td>
559
- <pre class="lines">
560
-
561
-
562
- 35
563
- 36
564
- 37</pre>
565
- </td>
566
- <td>
567
- <pre class="code"><span class="info file"># File 'lib/marky_markov.rb', line 35</span>
568
-
569
- <span class='kw'>def</span> <span class='id identifier rubyid_parse_string'>parse_string</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='rparen'>)</span>
570
- <span class='ivar'>@dictionary</span><span class='period'>.</span><span class='id identifier rubyid_parse_source'>parse_source</span><span class='lparen'>(</span><span class='id identifier rubyid_string'>string</span><span class='comma'>,</span> <span class='kw'>false</span><span class='rparen'>)</span>
571
- <span class='kw'>end</span></pre>
572
- </td>
573
- </tr>
574
- </table>
575
- </div>
576
-
577
- </div>
578
-
579
- </div>
580
-
581
- <div id="footer">
582
- Generated on Mon Feb 6 22:18:54 2012 by
583
- <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
584
- 0.7.5 (ruby-1.9.3).
585
- </div>
586
-
587
- </body>
588
- </html>