classifier 1.3.0 → 1.3.1
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/README +2 -1
- data/Rakefile +3 -4
- data/bin/bayes.rb +1 -1
- data/bin/summarize.rb +7 -2
- data/lib/classifier/extensions/string.rb +2 -2
- data/lib/classifier/extensions/vector_serialize.rb +2 -2
- data/lib/classifier/lsi.rb +2 -2
- data/lib/classifier/lsi/content_node.rb +1 -1
- metadata +73 -159
- data/doc/classes/Array.html +0 -139
- data/doc/classes/Array.src/M000003.html +0 -18
- data/doc/classes/Classifier.html +0 -140
- data/doc/classes/Classifier/Bayes.html +0 -317
- data/doc/classes/Classifier/Bayes.src/M000038.html +0 -20
- data/doc/classes/Classifier/Bayes.src/M000039.html +0 -23
- data/doc/classes/Classifier/Bayes.src/M000040.html +0 -30
- data/doc/classes/Classifier/Bayes.src/M000041.html +0 -27
- data/doc/classes/Classifier/Bayes.src/M000042.html +0 -18
- data/doc/classes/Classifier/Bayes.src/M000043.html +0 -25
- data/doc/classes/Classifier/Bayes.src/M000044.html +0 -18
- data/doc/classes/Classifier/ContentNode.html +0 -247
- data/doc/classes/Classifier/ContentNode.src/M000046.html +0 -19
- data/doc/classes/Classifier/ContentNode.src/M000047.html +0 -18
- data/doc/classes/Classifier/ContentNode.src/M000048.html +0 -18
- data/doc/classes/Classifier/ContentNode.src/M000049.html +0 -49
- data/doc/classes/Classifier/LSI.html +0 -539
- data/doc/classes/Classifier/LSI.src/M000022.html +0 -20
- data/doc/classes/Classifier/LSI.src/M000023.html +0 -18
- data/doc/classes/Classifier/LSI.src/M000024.html +0 -21
- data/doc/classes/Classifier/LSI.src/M000025.html +0 -18
- data/doc/classes/Classifier/LSI.src/M000026.html +0 -19
- data/doc/classes/Classifier/LSI.src/M000027.html +0 -21
- data/doc/classes/Classifier/LSI.src/M000028.html +0 -18
- data/doc/classes/Classifier/LSI.src/M000029.html +0 -19
- data/doc/classes/Classifier/LSI.src/M000030.html +0 -43
- data/doc/classes/Classifier/LSI.src/M000031.html +0 -23
- data/doc/classes/Classifier/LSI.src/M000032.html +0 -30
- data/doc/classes/Classifier/LSI.src/M000033.html +0 -30
- data/doc/classes/Classifier/LSI.src/M000034.html +0 -21
- data/doc/classes/Classifier/LSI.src/M000035.html +0 -21
- data/doc/classes/Classifier/LSI.src/M000036.html +0 -31
- data/doc/classes/Classifier/LSI.src/M000037.html +0 -21
- data/doc/classes/Classifier/WordList.html +0 -217
- data/doc/classes/Classifier/WordList.src/M000017.html +0 -18
- data/doc/classes/Classifier/WordList.src/M000018.html +0 -19
- data/doc/classes/Classifier/WordList.src/M000019.html +0 -19
- data/doc/classes/Classifier/WordList.src/M000020.html +0 -18
- data/doc/classes/Classifier/WordList.src/M000021.html +0 -18
- data/doc/classes/GSL.html +0 -112
- data/doc/classes/GSL/Matrix.html +0 -126
- data/doc/classes/GSL/Vector.html +0 -156
- data/doc/classes/GSL/Vector.src/M000015.html +0 -18
- data/doc/classes/GSL/Vector.src/M000016.html +0 -19
- data/doc/classes/Matrix.html +0 -184
- data/doc/classes/Matrix.src/M000004.html +0 -18
- data/doc/classes/Matrix.src/M000005.html +0 -76
- data/doc/classes/Matrix.src/M000006.html +0 -18
- data/doc/classes/Object.html +0 -139
- data/doc/classes/Object.src/M000007.html +0 -16
- data/doc/classes/String.html +0 -275
- data/doc/classes/String.src/M000008.html +0 -18
- data/doc/classes/String.src/M000009.html +0 -18
- data/doc/classes/String.src/M000010.html +0 -18
- data/doc/classes/String.src/M000011.html +0 -18
- data/doc/classes/String.src/M000012.html +0 -18
- data/doc/classes/String.src/M000013.html +0 -18
- data/doc/classes/String.src/M000014.html +0 -18
- data/doc/classes/Vector.html +0 -154
- data/doc/classes/Vector.src/M000001.html +0 -22
- data/doc/classes/Vector.src/M000002.html +0 -25
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -252
- data/doc/files/lib/classifier/bayes_rb.html +0 -115
- data/doc/files/lib/classifier/extensions/string_rb.html +0 -122
- data/doc/files/lib/classifier/extensions/vector_rb.html +0 -120
- data/doc/files/lib/classifier/extensions/vector_serialize_rb.html +0 -101
- data/doc/files/lib/classifier/extensions/word_hash_rb.html +0 -115
- data/doc/files/lib/classifier/lsi/content_node_rb.html +0 -115
- data/doc/files/lib/classifier/lsi/summary_rb.html +0 -115
- data/doc/files/lib/classifier/lsi/word_list_rb.html +0 -115
- data/doc/files/lib/classifier/lsi_rb.html +0 -127
- data/doc/files/lib/classifier_rb.html +0 -125
- data/doc/fr_class_index.html +0 -39
- data/doc/fr_file_index.html +0 -37
- data/doc/fr_method_index.html +0 -75
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html>
|
|
7
|
-
<head>
|
|
8
|
-
<title>sum (Array)</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
11
|
-
</head>
|
|
12
|
-
<body class="standalone-code">
|
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/classifier/extensions/vector.rb, line 10</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sum</span>
|
|
15
|
-
<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">sum</span>,<span class="ruby-identifier">term</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">term</span> }.<span class="ruby-identifier">to_f</span>
|
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
data/doc/classes/Classifier.html
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Module: Classifier</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Module</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Classifier</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../files/lib/classifier/bayes_rb.html">
|
|
59
|
-
lib/classifier/bayes.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
<a href="../files/lib/classifier/lsi_rb.html">
|
|
63
|
-
lib/classifier/lsi.rb
|
|
64
|
-
</a>
|
|
65
|
-
<br />
|
|
66
|
-
<a href="../files/lib/classifier/lsi/content_node_rb.html">
|
|
67
|
-
lib/classifier/lsi/content_node.rb
|
|
68
|
-
</a>
|
|
69
|
-
<br />
|
|
70
|
-
<a href="../files/lib/classifier/lsi/word_list_rb.html">
|
|
71
|
-
lib/classifier/lsi/word_list.rb
|
|
72
|
-
</a>
|
|
73
|
-
<br />
|
|
74
|
-
</td>
|
|
75
|
-
</tr>
|
|
76
|
-
|
|
77
|
-
</table>
|
|
78
|
-
</div>
|
|
79
|
-
<!-- banner header -->
|
|
80
|
-
|
|
81
|
-
<div id="bodyContent">
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<div id="contextContent">
|
|
86
|
-
|
|
87
|
-
<div id="description">
|
|
88
|
-
<table>
|
|
89
|
-
<tr><td valign="top">Author:</td><td>David Fayram (<a href="mailto:dfayram@lensmen.net">dfayram@lensmen.net</a>)
|
|
90
|
-
|
|
91
|
-
</td></tr>
|
|
92
|
-
<tr><td valign="top">Copyright:</td><td>Copyright © 2005 David Fayram II
|
|
93
|
-
|
|
94
|
-
</td></tr>
|
|
95
|
-
<tr><td valign="top">License:</td><td>LGPL
|
|
96
|
-
|
|
97
|
-
</td></tr>
|
|
98
|
-
</table>
|
|
99
|
-
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
</div>
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<!-- if includes -->
|
|
110
|
-
|
|
111
|
-
<div id="section">
|
|
112
|
-
|
|
113
|
-
<div id="class-list">
|
|
114
|
-
<h3 class="section-bar">Classes and Modules</h3>
|
|
115
|
-
|
|
116
|
-
Class <a href="Classifier/Bayes.html" class="link">Classifier::Bayes</a><br />
|
|
117
|
-
Class <a href="Classifier/ContentNode.html" class="link">Classifier::ContentNode</a><br />
|
|
118
|
-
Class <a href="Classifier/LSI.html" class="link">Classifier::LSI</a><br />
|
|
119
|
-
Class <a href="Classifier/WordList.html" class="link">Classifier::WordList</a><br />
|
|
120
|
-
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
<!-- if method_list -->
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
<div id="validator-badges">
|
|
136
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
137
|
-
</div>
|
|
138
|
-
|
|
139
|
-
</body>
|
|
140
|
-
</html>
|
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>Class: Classifier::Bayes</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="classHeader">
|
|
50
|
-
<table class="header-table">
|
|
51
|
-
<tr class="top-aligned-row">
|
|
52
|
-
<td><strong>Class</strong></td>
|
|
53
|
-
<td class="class-name-in-header">Classifier::Bayes</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../../files/lib/classifier/bayes_rb.html">
|
|
59
|
-
lib/classifier/bayes.rb
|
|
60
|
-
</a>
|
|
61
|
-
<br />
|
|
62
|
-
</td>
|
|
63
|
-
</tr>
|
|
64
|
-
|
|
65
|
-
<tr class="top-aligned-row">
|
|
66
|
-
<td><strong>Parent:</strong></td>
|
|
67
|
-
<td>
|
|
68
|
-
<a href="../Object.html">
|
|
69
|
-
Object
|
|
70
|
-
</a>
|
|
71
|
-
</td>
|
|
72
|
-
</tr>
|
|
73
|
-
</table>
|
|
74
|
-
</div>
|
|
75
|
-
<!-- banner header -->
|
|
76
|
-
|
|
77
|
-
<div id="bodyContent">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<div id="contextContent">
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
</div>
|
|
86
|
-
|
|
87
|
-
<div id="method-list">
|
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
|
89
|
-
|
|
90
|
-
<div class="name-list">
|
|
91
|
-
<a href="#M000044">add_category</a>
|
|
92
|
-
<a href="#M000045">append_category</a>
|
|
93
|
-
<a href="#M000041">classifications</a>
|
|
94
|
-
<a href="#M000042">classify</a>
|
|
95
|
-
<a href="#M000043">method_missing</a>
|
|
96
|
-
<a href="#M000038">new</a>
|
|
97
|
-
<a href="#M000039">train</a>
|
|
98
|
-
<a href="#M000040">untrain</a>
|
|
99
|
-
</div>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
</div>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
<!-- if includes -->
|
|
106
|
-
|
|
107
|
-
<div id="section">
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
<!-- if method_list -->
|
|
117
|
-
<div id="methods">
|
|
118
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
119
|
-
|
|
120
|
-
<div id="method-M000038" class="method-detail">
|
|
121
|
-
<a name="M000038"></a>
|
|
122
|
-
|
|
123
|
-
<div class="method-heading">
|
|
124
|
-
<a href="Bayes.src/M000038.html" target="Code" class="method-signature"
|
|
125
|
-
onclick="popupCode('Bayes.src/M000038.html');return false;">
|
|
126
|
-
<span class="method-name">new</span><span class="method-args">(*categories)</span>
|
|
127
|
-
</a>
|
|
128
|
-
</div>
|
|
129
|
-
|
|
130
|
-
<div class="method-description">
|
|
131
|
-
<p>
|
|
132
|
-
The class can be created with one or more categories, each of which will be
|
|
133
|
-
initialized and given a training method. E.g.,
|
|
134
|
-
</p>
|
|
135
|
-
<pre>
|
|
136
|
-
b = Classifier::Bayes.new 'Interesting', 'Uninteresting', 'Spam'
|
|
137
|
-
</pre>
|
|
138
|
-
</div>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
142
|
-
|
|
143
|
-
<div id="method-M000044" class="method-detail">
|
|
144
|
-
<a name="M000044"></a>
|
|
145
|
-
|
|
146
|
-
<div class="method-heading">
|
|
147
|
-
<a href="Bayes.src/M000044.html" target="Code" class="method-signature"
|
|
148
|
-
onclick="popupCode('Bayes.src/M000044.html');return false;">
|
|
149
|
-
<span class="method-name">add_category</span><span class="method-args">(category)</span>
|
|
150
|
-
</a>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div class="method-description">
|
|
154
|
-
<p>
|
|
155
|
-
Allows you to add categories to the classifier. For example:
|
|
156
|
-
</p>
|
|
157
|
-
<pre>
|
|
158
|
-
b.add_category "Not spam"
|
|
159
|
-
</pre>
|
|
160
|
-
<p>
|
|
161
|
-
WARNING: Adding categories to a trained classifier will result in an
|
|
162
|
-
undertrained category that will tend to match more criteria than the
|
|
163
|
-
trained selective categories. In short, try to initialize your categories
|
|
164
|
-
at initialization.
|
|
165
|
-
</p>
|
|
166
|
-
</div>
|
|
167
|
-
</div>
|
|
168
|
-
|
|
169
|
-
<div id="method-M000045" class="method-detail">
|
|
170
|
-
<a name="M000045"></a>
|
|
171
|
-
|
|
172
|
-
<div class="method-heading">
|
|
173
|
-
<span class="method-name">append_category</span><span class="method-args">(category)</span>
|
|
174
|
-
</div>
|
|
175
|
-
|
|
176
|
-
<div class="method-description">
|
|
177
|
-
<p>
|
|
178
|
-
Alias for <a href="Bayes.html#M000044">add_category</a>
|
|
179
|
-
</p>
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
<div id="method-M000041" class="method-detail">
|
|
184
|
-
<a name="M000041"></a>
|
|
185
|
-
|
|
186
|
-
<div class="method-heading">
|
|
187
|
-
<a href="Bayes.src/M000041.html" target="Code" class="method-signature"
|
|
188
|
-
onclick="popupCode('Bayes.src/M000041.html');return false;">
|
|
189
|
-
<span class="method-name">classifications</span><span class="method-args">(text)</span>
|
|
190
|
-
</a>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<div class="method-description">
|
|
194
|
-
<p>
|
|
195
|
-
Returns the scores in each category the provided <tt>text</tt>. E.g.,
|
|
196
|
-
</p>
|
|
197
|
-
<pre>
|
|
198
|
-
b.classifications "I hate bad words and you"
|
|
199
|
-
=> {"Uninteresting"=>-12.6997928013932, "Interesting"=>-18.4206807439524}
|
|
200
|
-
</pre>
|
|
201
|
-
<p>
|
|
202
|
-
The largest of these scores (the one closest to 0) is the one picked out by
|
|
203
|
-
<a href="Bayes.html#M000042">classify</a>
|
|
204
|
-
</p>
|
|
205
|
-
</div>
|
|
206
|
-
</div>
|
|
207
|
-
|
|
208
|
-
<div id="method-M000042" class="method-detail">
|
|
209
|
-
<a name="M000042"></a>
|
|
210
|
-
|
|
211
|
-
<div class="method-heading">
|
|
212
|
-
<a href="Bayes.src/M000042.html" target="Code" class="method-signature"
|
|
213
|
-
onclick="popupCode('Bayes.src/M000042.html');return false;">
|
|
214
|
-
<span class="method-name">classify</span><span class="method-args">(text)</span>
|
|
215
|
-
</a>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div class="method-description">
|
|
219
|
-
<p>
|
|
220
|
-
Returns the classification of the provided <tt>text</tt>, which is one of
|
|
221
|
-
the categories given in the initializer. E.g.,
|
|
222
|
-
</p>
|
|
223
|
-
<pre>
|
|
224
|
-
b.classify "I hate bad words and you"
|
|
225
|
-
=> 'Uninteresting'
|
|
226
|
-
</pre>
|
|
227
|
-
</div>
|
|
228
|
-
</div>
|
|
229
|
-
|
|
230
|
-
<div id="method-M000043" class="method-detail">
|
|
231
|
-
<a name="M000043"></a>
|
|
232
|
-
|
|
233
|
-
<div class="method-heading">
|
|
234
|
-
<a href="Bayes.src/M000043.html" target="Code" class="method-signature"
|
|
235
|
-
onclick="popupCode('Bayes.src/M000043.html');return false;">
|
|
236
|
-
<span class="method-name">method_missing</span><span class="method-args">(name, *args)</span>
|
|
237
|
-
</a>
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
<div class="method-description">
|
|
241
|
-
<p>
|
|
242
|
-
Provides training and untraining methods for the categories specified in <a
|
|
243
|
-
href="Bayes.html#M000038">Bayes#new</a> For example:
|
|
244
|
-
</p>
|
|
245
|
-
<pre>
|
|
246
|
-
b = Classifier::Bayes.new 'This', 'That', 'the_other'
|
|
247
|
-
b.train_this "This text"
|
|
248
|
-
b.train_that "That text"
|
|
249
|
-
b.untrain_that "That text"
|
|
250
|
-
b.train_the_other "The other text"
|
|
251
|
-
</pre>
|
|
252
|
-
</div>
|
|
253
|
-
</div>
|
|
254
|
-
|
|
255
|
-
<div id="method-M000039" class="method-detail">
|
|
256
|
-
<a name="M000039"></a>
|
|
257
|
-
|
|
258
|
-
<div class="method-heading">
|
|
259
|
-
<a href="Bayes.src/M000039.html" target="Code" class="method-signature"
|
|
260
|
-
onclick="popupCode('Bayes.src/M000039.html');return false;">
|
|
261
|
-
<span class="method-name">train</span><span class="method-args">(category, text)</span>
|
|
262
|
-
</a>
|
|
263
|
-
</div>
|
|
264
|
-
|
|
265
|
-
<div class="method-description">
|
|
266
|
-
<p>
|
|
267
|
-
Provides a general training method for all categories specified in <a
|
|
268
|
-
href="Bayes.html#M000038">Bayes#new</a> For example:
|
|
269
|
-
</p>
|
|
270
|
-
<pre>
|
|
271
|
-
b = Classifier::Bayes.new 'This', 'That', 'the_other'
|
|
272
|
-
b.train :this, "This text"
|
|
273
|
-
b.train "that", "That text"
|
|
274
|
-
b.train "The other", "The other text"
|
|
275
|
-
</pre>
|
|
276
|
-
</div>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<div id="method-M000040" class="method-detail">
|
|
280
|
-
<a name="M000040"></a>
|
|
281
|
-
|
|
282
|
-
<div class="method-heading">
|
|
283
|
-
<a href="Bayes.src/M000040.html" target="Code" class="method-signature"
|
|
284
|
-
onclick="popupCode('Bayes.src/M000040.html');return false;">
|
|
285
|
-
<span class="method-name">untrain</span><span class="method-args">(category, text)</span>
|
|
286
|
-
</a>
|
|
287
|
-
</div>
|
|
288
|
-
|
|
289
|
-
<div class="method-description">
|
|
290
|
-
<p>
|
|
291
|
-
Provides a untraining method for all categories specified in <a
|
|
292
|
-
href="Bayes.html#M000038">Bayes#new</a> Be very careful with this method.
|
|
293
|
-
</p>
|
|
294
|
-
<p>
|
|
295
|
-
For example:
|
|
296
|
-
</p>
|
|
297
|
-
<pre>
|
|
298
|
-
b = Classifier::Bayes.new 'This', 'That', 'the_other'
|
|
299
|
-
b.train :this, "This text"
|
|
300
|
-
b.untrain :this, "This text"
|
|
301
|
-
</pre>
|
|
302
|
-
</div>
|
|
303
|
-
</div>
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
</div>
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
</div>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
<div id="validator-badges">
|
|
313
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
</body>
|
|
317
|
-
</html>
|