sexmachine 0.0.5 → 0.0.6
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.
- data/Rakefile +0 -1
- data/lib/sexmachine/detector.rb +16 -14
- data/lib/sexmachine/version.rb +1 -1
- metadata +33 -34
- data/docs/README_rdoc.html +0 -123
- data/docs/SexMachine.html +0 -163
- data/docs/SexMachine/Detector.html +0 -376
- data/docs/created.rid +0 -5
- data/docs/index.html +0 -68
- data/docs/lib/sexmachine/detector_rb.html +0 -52
- data/docs/lib/sexmachine/version_rb.html +0 -52
- data/docs/lib/sexmachine_rb.html +0 -56
- data/docs/rdoc.css +0 -706
@@ -1,376 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
7
|
-
|
8
|
-
<title>Class: SexMachine::Detector</title>
|
9
|
-
|
10
|
-
<link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
|
11
|
-
|
12
|
-
<script src="../js/jquery.js" type="text/javascript"
|
13
|
-
charset="utf-8"></script>
|
14
|
-
<script src="../js/thickbox-compressed.js" type="text/javascript"
|
15
|
-
charset="utf-8"></script>
|
16
|
-
<script src="../js/quicksearch.js" type="text/javascript"
|
17
|
-
charset="utf-8"></script>
|
18
|
-
<script src="../js/darkfish.js" type="text/javascript"
|
19
|
-
charset="utf-8"></script>
|
20
|
-
|
21
|
-
</head>
|
22
|
-
<body class="class">
|
23
|
-
|
24
|
-
<div id="metadata">
|
25
|
-
<div id="home-metadata">
|
26
|
-
<div id="home-section" class="section">
|
27
|
-
<h3 class="section-header">
|
28
|
-
<a href="../index.html">Home</a>
|
29
|
-
<a href="../index.html#classes">Classes</a>
|
30
|
-
<a href="../index.html#methods">Methods</a>
|
31
|
-
</h3>
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="file-metadata">
|
36
|
-
<div id="file-list-section" class="section">
|
37
|
-
<h3 class="section-header">In Files</h3>
|
38
|
-
<div class="section-body">
|
39
|
-
<ul>
|
40
|
-
|
41
|
-
<li><a href="../lib/sexmachine/detector_rb.html?TB_iframe=true&height=550&width=785"
|
42
|
-
class="thickbox" title="lib/sexmachine/detector.rb">lib/sexmachine/detector.rb</a></li>
|
43
|
-
|
44
|
-
</ul>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
|
48
|
-
|
49
|
-
</div>
|
50
|
-
|
51
|
-
<div id="class-metadata">
|
52
|
-
|
53
|
-
<!-- Parent Class -->
|
54
|
-
|
55
|
-
<div id="parent-class-section" class="section">
|
56
|
-
<h3 class="section-header">Parent</h3>
|
57
|
-
|
58
|
-
<p class="link">Object</p>
|
59
|
-
|
60
|
-
</div>
|
61
|
-
|
62
|
-
|
63
|
-
<!-- Namespace Contents -->
|
64
|
-
|
65
|
-
|
66
|
-
<!-- Method Quickref -->
|
67
|
-
|
68
|
-
<div id="method-list-section" class="section">
|
69
|
-
<h3 class="section-header">Methods</h3>
|
70
|
-
<ul class="link-list">
|
71
|
-
|
72
|
-
<li><a href="#method-c-new">::new</a></li>
|
73
|
-
|
74
|
-
<li><a href="#method-i-eatNameLine">#eatNameLine</a></li>
|
75
|
-
|
76
|
-
<li><a href="#method-i-get_gender">#get_gender</a></li>
|
77
|
-
|
78
|
-
<li><a href="#method-i-parse">#parse</a></li>
|
79
|
-
|
80
|
-
<li><a href="#method-i-set">#set</a></li>
|
81
|
-
|
82
|
-
</ul>
|
83
|
-
</div>
|
84
|
-
|
85
|
-
|
86
|
-
<!-- Included Modules -->
|
87
|
-
|
88
|
-
</div>
|
89
|
-
|
90
|
-
<div id="project-metadata">
|
91
|
-
|
92
|
-
|
93
|
-
<div id="fileindex-section" class="section project-section">
|
94
|
-
<h3 class="section-header">Files</h3>
|
95
|
-
<ul>
|
96
|
-
|
97
|
-
<li class="file"><a href="../README_rdoc.html">README.rdoc</a></li>
|
98
|
-
|
99
|
-
</ul>
|
100
|
-
</div>
|
101
|
-
|
102
|
-
|
103
|
-
<div id="classindex-section" class="section project-section">
|
104
|
-
<h3 class="section-header">Class Index
|
105
|
-
<span class="search-toggle"><img src="../images/find.png"
|
106
|
-
height="16" width="16" alt="[+]"
|
107
|
-
title="show/hide quicksearch" /></span></h3>
|
108
|
-
<form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
|
109
|
-
<fieldset>
|
110
|
-
<legend>Quicksearch</legend>
|
111
|
-
<input type="text" name="quicksearch" value=""
|
112
|
-
class="quicksearch-field" />
|
113
|
-
</fieldset>
|
114
|
-
</form>
|
115
|
-
|
116
|
-
<ul class="link-list">
|
117
|
-
|
118
|
-
<li><a href="../SexMachine.html">SexMachine</a></li>
|
119
|
-
|
120
|
-
<li><a href="../SexMachine/Detector.html">SexMachine::Detector</a></li>
|
121
|
-
|
122
|
-
</ul>
|
123
|
-
<div id="no-class-search-results" style="display: none;">No matching classes.</div>
|
124
|
-
</div>
|
125
|
-
|
126
|
-
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
<div id="documentation">
|
131
|
-
<h1 class="class">SexMachine::Detector</h1>
|
132
|
-
|
133
|
-
<div id="description">
|
134
|
-
|
135
|
-
</div>
|
136
|
-
|
137
|
-
<!-- Constants -->
|
138
|
-
|
139
|
-
|
140
|
-
<!-- Attributes -->
|
141
|
-
|
142
|
-
|
143
|
-
<!-- Methods -->
|
144
|
-
|
145
|
-
<div id="public-class-method-details" class="method-section section">
|
146
|
-
<h3 class="section-header">Public Class Methods</h3>
|
147
|
-
|
148
|
-
|
149
|
-
<div id="new-method" class="method-detail ">
|
150
|
-
<a name="method-c-new"></a>
|
151
|
-
|
152
|
-
<div class="method-heading">
|
153
|
-
|
154
|
-
<span class="method-name">new</span><span
|
155
|
-
class="method-args">(fname=nil)</span>
|
156
|
-
<span class="method-click-advice">click to toggle source</span>
|
157
|
-
|
158
|
-
</div>
|
159
|
-
|
160
|
-
<div class="method-description">
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
<div class="method-source-code"
|
167
|
-
id="new-source">
|
168
|
-
<pre>
|
169
|
-
<span class="ruby-comment cmt"># File lib/sexmachine/detector.rb, line 4</span>
|
170
|
-
4: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">fname</span>=<span class="ruby-keyword kw">nil</span>)
|
171
|
-
5: <span class="ruby-identifier">fname</span> <span class="ruby-operator">||=</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-value str">'../data/nam_dict.txt'</span>, <span class="ruby-keyword kw">__FILE__</span>)
|
172
|
-
6: <span class="ruby-identifier">parse</span> <span class="ruby-identifier">fname</span>
|
173
|
-
7: <span class="ruby-keyword kw">end</span></pre>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
</div>
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
</div>
|
182
|
-
|
183
|
-
|
184
|
-
</div>
|
185
|
-
|
186
|
-
<div id="public-instance-method-details" class="method-section section">
|
187
|
-
<h3 class="section-header">Public Instance Methods</h3>
|
188
|
-
|
189
|
-
|
190
|
-
<div id="get-gender-method" class="method-detail ">
|
191
|
-
<a name="method-i-get_gender"></a>
|
192
|
-
|
193
|
-
<div class="method-heading">
|
194
|
-
|
195
|
-
<span class="method-name">get_gender</span><span
|
196
|
-
class="method-args">(name)</span>
|
197
|
-
<span class="method-click-advice">click to toggle source</span>
|
198
|
-
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div class="method-description">
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
<div class="method-source-code"
|
208
|
-
id="get-gender-source">
|
209
|
-
<pre>
|
210
|
-
<span class="ruby-comment cmt"># File lib/sexmachine/detector.rb, line 18</span>
|
211
|
-
18: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_gender</span>(<span class="ruby-identifier">name</span>)
|
212
|
-
19: <span class="ruby-ivar">@names</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">name</span>, <span class="ruby-value">:andy</span>)
|
213
|
-
20: <span class="ruby-keyword kw">end</span></pre>
|
214
|
-
</div>
|
215
|
-
|
216
|
-
</div>
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
</div>
|
222
|
-
|
223
|
-
|
224
|
-
<div id="parse-method" class="method-detail ">
|
225
|
-
<a name="method-i-parse"></a>
|
226
|
-
|
227
|
-
<div class="method-heading">
|
228
|
-
|
229
|
-
<span class="method-name">parse</span><span
|
230
|
-
class="method-args">(fname)</span>
|
231
|
-
<span class="method-click-advice">click to toggle source</span>
|
232
|
-
|
233
|
-
</div>
|
234
|
-
|
235
|
-
<div class="method-description">
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
<div class="method-source-code"
|
242
|
-
id="parse-source">
|
243
|
-
<pre>
|
244
|
-
<span class="ruby-comment cmt"># File lib/sexmachine/detector.rb, line 9</span>
|
245
|
-
9: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">parse</span>(<span class="ruby-identifier">fname</span>)
|
246
|
-
10: <span class="ruby-ivar">@names</span> = {}
|
247
|
-
11: <span class="ruby-identifier">open</span>(<span class="ruby-identifier">fname</span>, <span class="ruby-value str">"r:iso8859-1:utf-8"</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">f</span><span class="ruby-operator">|</span>
|
248
|
-
12: <span class="ruby-identifier">f</span>.<span class="ruby-identifier">each_line</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">line</span><span class="ruby-operator">|</span>
|
249
|
-
13: <span class="ruby-identifier">eatNameLine</span> <span class="ruby-identifier">line</span>
|
250
|
-
14: }
|
251
|
-
15: }
|
252
|
-
16: <span class="ruby-keyword kw">end</span></pre>
|
253
|
-
</div>
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
</div>
|
261
|
-
|
262
|
-
|
263
|
-
</div>
|
264
|
-
|
265
|
-
<div id="private-instance-method-details" class="method-section section">
|
266
|
-
<h3 class="section-header">Private Instance Methods</h3>
|
267
|
-
|
268
|
-
|
269
|
-
<div id="eat-ame-ine-method" class="method-detail ">
|
270
|
-
<a name="method-i-eatNameLine"></a>
|
271
|
-
|
272
|
-
<div class="method-heading">
|
273
|
-
|
274
|
-
<span class="method-name">eatNameLine</span><span
|
275
|
-
class="method-args">(line)</span>
|
276
|
-
<span class="method-click-advice">click to toggle source</span>
|
277
|
-
|
278
|
-
</div>
|
279
|
-
|
280
|
-
<div class="method-description">
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
<div class="method-source-code"
|
287
|
-
id="eat-ame-ine-source">
|
288
|
-
<pre>
|
289
|
-
<span class="ruby-comment cmt"># File lib/sexmachine/detector.rb, line 23</span>
|
290
|
-
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eatNameLine</span>(<span class="ruby-identifier">line</span>)
|
291
|
-
24: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-node">"#"</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">start_with?</span>(<span class="ruby-value str">"="</span>)
|
292
|
-
25:
|
293
|
-
26: <span class="ruby-identifier">parts</span> = <span class="ruby-identifier">line</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">" "</span>).<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">strip</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">""</span> }
|
294
|
-
27:
|
295
|
-
28: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">include?</span> <span class="ruby-value str">"F"</span>
|
296
|
-
29: <span class="ruby-identifier">set</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">1</span>], <span class="ruby-value">:female</span>
|
297
|
-
30: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">include?</span> <span class="ruby-value str">"M"</span>
|
298
|
-
31: <span class="ruby-identifier">set</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">1</span>], <span class="ruby-value">:male</span>
|
299
|
-
32: <span class="ruby-keyword kw">else</span>
|
300
|
-
33: <span class="ruby-identifier">set</span> <span class="ruby-identifier">parts</span>[<span class="ruby-value">1</span>], <span class="ruby-value">:andy</span>
|
301
|
-
34: <span class="ruby-keyword kw">end</span>
|
302
|
-
35: <span class="ruby-keyword kw">end</span></pre>
|
303
|
-
</div>
|
304
|
-
|
305
|
-
</div>
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
</div>
|
311
|
-
|
312
|
-
|
313
|
-
<div id="set-method" class="method-detail ">
|
314
|
-
<a name="method-i-set"></a>
|
315
|
-
|
316
|
-
<div class="method-heading">
|
317
|
-
|
318
|
-
<span class="method-name">set</span><span
|
319
|
-
class="method-args">(name, gender)</span>
|
320
|
-
<span class="method-click-advice">click to toggle source</span>
|
321
|
-
|
322
|
-
</div>
|
323
|
-
|
324
|
-
<div class="method-description">
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
<div class="method-source-code"
|
331
|
-
id="set-source">
|
332
|
-
<pre>
|
333
|
-
<span class="ruby-comment cmt"># File lib/sexmachine/detector.rb, line 37</span>
|
334
|
-
37: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">gender</span>)
|
335
|
-
38: <span class="ruby-comment cmt"># go w/ first option, don't reset</span>
|
336
|
-
39: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@names</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">name</span>
|
337
|
-
40:
|
338
|
-
41: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">include?</span> <span class="ruby-value str">"+"</span>
|
339
|
-
42: [ <span class="ruby-value str">''</span>, <span class="ruby-value str">'-'</span>, <span class="ruby-value str">' '</span> ].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">replacement</span><span class="ruby-operator">|</span>
|
340
|
-
43: <span class="ruby-identifier">set</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-value str">"+"</span>, <span class="ruby-identifier">replacement</span>), <span class="ruby-identifier">gender</span>
|
341
|
-
44: }
|
342
|
-
45: <span class="ruby-keyword kw">else</span>
|
343
|
-
46: <span class="ruby-ivar">@names</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">gender</span>
|
344
|
-
47: <span class="ruby-keyword kw">end</span>
|
345
|
-
48: <span class="ruby-keyword kw">end</span></pre>
|
346
|
-
</div>
|
347
|
-
|
348
|
-
</div>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
</div>
|
354
|
-
|
355
|
-
|
356
|
-
</div>
|
357
|
-
|
358
|
-
|
359
|
-
</div>
|
360
|
-
|
361
|
-
|
362
|
-
<div id="rdoc-debugging-section-dump" class="debugging-section">
|
363
|
-
|
364
|
-
<p>Disabled; run with --debug to generate this.</p>
|
365
|
-
|
366
|
-
</div>
|
367
|
-
|
368
|
-
<div id="validator-badges">
|
369
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
370
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
371
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
372
|
-
</div>
|
373
|
-
|
374
|
-
</body>
|
375
|
-
</html>
|
376
|
-
|
data/docs/created.rid
DELETED
data/docs/index.html
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
4
|
-
|
5
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
6
|
-
<head>
|
7
|
-
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
|
8
|
-
|
9
|
-
<title>SexMachine - Gender from first name</title>
|
10
|
-
|
11
|
-
<link type="text/css" media="screen" href="rdoc.css" rel="stylesheet" />
|
12
|
-
|
13
|
-
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
|
14
|
-
<script src="js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
|
15
|
-
<script src="js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
|
16
|
-
<script src="js/darkfish.js" type="text/javascript" charset="utf-8"></script>
|
17
|
-
|
18
|
-
</head>
|
19
|
-
<body class="indexpage">
|
20
|
-
|
21
|
-
|
22
|
-
<h1>SexMachine - Gender from first name</h1>
|
23
|
-
|
24
|
-
|
25
|
-
<p>This is the API documentation for 'SexMachine - Gender from first name'.</p>
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
<h2>Files</h2>
|
31
|
-
<ul>
|
32
|
-
|
33
|
-
<li class="file"><a href="README_rdoc.html">README.rdoc</a></li>
|
34
|
-
|
35
|
-
</ul>
|
36
|
-
|
37
|
-
|
38
|
-
<h2 id="classes">Classes/Modules</h2>
|
39
|
-
<ul>
|
40
|
-
|
41
|
-
<li class="module"><a href="SexMachine.html">SexMachine</a></li>
|
42
|
-
|
43
|
-
<li class="class"><a href="SexMachine/Detector.html">SexMachine::Detector</a></li>
|
44
|
-
|
45
|
-
</ul>
|
46
|
-
|
47
|
-
<h2 id="methods">Methods</h2>
|
48
|
-
<ul>
|
49
|
-
|
50
|
-
<li><a href="SexMachine/Detector.html#method-c-new">::new — SexMachine::Detector</a></li>
|
51
|
-
|
52
|
-
<li><a href="SexMachine/Detector.html#method-i-eatNameLine">#eatNameLine — SexMachine::Detector</a></li>
|
53
|
-
|
54
|
-
<li><a href="SexMachine/Detector.html#method-i-get_gender">#get_gender — SexMachine::Detector</a></li>
|
55
|
-
|
56
|
-
<li><a href="SexMachine/Detector.html#method-i-parse">#parse — SexMachine::Detector</a></li>
|
57
|
-
|
58
|
-
<li><a href="SexMachine/Detector.html#method-i-set">#set — SexMachine::Detector</a></li>
|
59
|
-
|
60
|
-
</ul>
|
61
|
-
|
62
|
-
<div id="validator-badges">
|
63
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
64
|
-
<p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
|
65
|
-
Rdoc Generator</a> 1.1.6</small>.</p>
|
66
|
-
</div>
|
67
|
-
</body>
|
68
|
-
</html>
|