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,20 +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>new (Classifier::Bayes)</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/bayes.rb, line 11</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">categories</span>)
|
|
15
|
-
<span class="ruby-ivar">@categories</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
|
16
|
-
<span class="ruby-identifier">categories</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">category</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>.<span class="ruby-identifier">prepare_category_name</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span> }
|
|
17
|
-
<span class="ruby-ivar">@total_words</span> = <span class="ruby-value">0</span>
|
|
18
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
19
|
-
</body>
|
|
20
|
-
</html>
|
|
@@ -1,23 +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>train (Classifier::Bayes)</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/bayes.rb, line 24</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">train</span>(<span class="ruby-identifier">category</span>, <span class="ruby-identifier">text</span>)
|
|
15
|
-
<span class="ruby-identifier">category</span> = <span class="ruby-identifier">category</span>.<span class="ruby-identifier">prepare_category_name</span>
|
|
16
|
-
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">word_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">word</span>, <span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
|
|
17
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
|
18
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">count</span>
|
|
19
|
-
<span class="ruby-ivar">@total_words</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">count</span>
|
|
20
|
-
<span class="ruby-keyword kw">end</span>
|
|
21
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
22
|
-
</body>
|
|
23
|
-
</html>
|
|
@@ -1,30 +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>untrain (Classifier::Bayes)</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/bayes.rb, line 41</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">untrain</span>(<span class="ruby-identifier">category</span>, <span class="ruby-identifier">text</span>)
|
|
15
|
-
<span class="ruby-identifier">category</span> = <span class="ruby-identifier">category</span>.<span class="ruby-identifier">prepare_category_name</span>
|
|
16
|
-
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">word_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">word</span>, <span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
|
|
17
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@total_words</span> <span class="ruby-operator">>=</span> <span class="ruby-value">0</span>
|
|
18
|
-
<span class="ruby-identifier">orig</span> = <span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>]
|
|
19
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span>
|
|
20
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>] <span class="ruby-operator">-=</span> <span class="ruby-identifier">count</span>
|
|
21
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>][<span class="ruby-identifier">word</span>] <span class="ruby-operator"><=</span> <span class="ruby-value">0</span>
|
|
22
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>].<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">word</span>)
|
|
23
|
-
<span class="ruby-identifier">count</span> = <span class="ruby-identifier">orig</span>
|
|
24
|
-
<span class="ruby-keyword kw">end</span>
|
|
25
|
-
<span class="ruby-ivar">@total_words</span> <span class="ruby-operator">-=</span> <span class="ruby-identifier">count</span>
|
|
26
|
-
<span class="ruby-keyword kw">end</span>
|
|
27
|
-
<span class="ruby-keyword kw">end</span>
|
|
28
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
29
|
-
</body>
|
|
30
|
-
</html>
|
|
@@ -1,27 +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>classifications (Classifier::Bayes)</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/bayes.rb, line 62</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">classifications</span>(<span class="ruby-identifier">text</span>)
|
|
15
|
-
<span class="ruby-identifier">score</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
|
16
|
-
<span class="ruby-ivar">@categories</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">category</span>, <span class="ruby-identifier">category_words</span><span class="ruby-operator">|</span>
|
|
17
|
-
<span class="ruby-identifier">score</span>[<span class="ruby-identifier">category</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-value">0</span>
|
|
18
|
-
<span class="ruby-identifier">total</span> = <span class="ruby-identifier">category_words</span>.<span class="ruby-identifier">values</span>.<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">element</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sum</span><span class="ruby-operator">+</span><span class="ruby-identifier">element</span>}
|
|
19
|
-
<span class="ruby-identifier">text</span>.<span class="ruby-identifier">word_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">word</span>, <span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
|
|
20
|
-
<span class="ruby-identifier">s</span> = <span class="ruby-identifier">category_words</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">word</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">category_words</span>[<span class="ruby-identifier">word</span>] <span class="ruby-operator">:</span> <span class="ruby-value">0</span><span class="ruby-value">.1</span>
|
|
21
|
-
<span class="ruby-identifier">score</span>[<span class="ruby-identifier">category</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-operator">+=</span> <span class="ruby-constant">Math</span>.<span class="ruby-identifier">log</span>(<span class="ruby-identifier">s</span><span class="ruby-operator">/</span><span class="ruby-identifier">total</span>.<span class="ruby-identifier">to_f</span>)
|
|
22
|
-
<span class="ruby-keyword kw">end</span>
|
|
23
|
-
<span class="ruby-keyword kw">end</span>
|
|
24
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">score</span>
|
|
25
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
26
|
-
</body>
|
|
27
|
-
</html>
|
|
@@ -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>classify (Classifier::Bayes)</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/bayes.rb, line 80</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">classify</span>(<span class="ruby-identifier">text</span>)
|
|
15
|
-
(<span class="ruby-identifier">classifications</span>(<span class="ruby-identifier">text</span>).<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-operator">-</span><span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] })[<span class="ruby-value">0</span>][<span class="ruby-value">0</span>]
|
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
@@ -1,25 +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>method_missing (Classifier::Bayes)</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/bayes.rb, line 92</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
|
|
15
|
-
<span class="ruby-identifier">category</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/(un)?train_([\w]+)/</span>, <span class="ruby-value str">'\2'</span>).<span class="ruby-identifier">prepare_category_name</span>
|
|
16
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@categories</span>.<span class="ruby-identifier">has_key?</span> <span class="ruby-identifier">category</span>
|
|
17
|
-
<span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">text</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">"#{$1}train(category, text)"</span>) }
|
|
18
|
-
<span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/(un)?train_([\w]+)/</span>
|
|
19
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-node">"No such category: #{category}"</span>
|
|
20
|
-
<span class="ruby-keyword kw">else</span>
|
|
21
|
-
<span class="ruby-keyword kw">super</span> <span class="ruby-comment cmt">#raise StandardError, "No such method: #{name}"</span>
|
|
22
|
-
<span class="ruby-keyword kw">end</span>
|
|
23
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
24
|
-
</body>
|
|
25
|
-
</html>
|
|
@@ -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>add_category (Classifier::Bayes)</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/bayes.rb, line 121</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_category</span>(<span class="ruby-identifier">category</span>)
|
|
15
|
-
<span class="ruby-ivar">@categories</span>[<span class="ruby-identifier">category</span>.<span class="ruby-identifier">prepare_category_name</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|
|
@@ -1,247 +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::ContentNode</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::ContentNode</td>
|
|
54
|
-
</tr>
|
|
55
|
-
<tr class="top-aligned-row">
|
|
56
|
-
<td><strong>In:</strong></td>
|
|
57
|
-
<td>
|
|
58
|
-
<a href="../../files/lib/classifier/lsi/content_node_rb.html">
|
|
59
|
-
lib/classifier/lsi/content_node.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
|
-
<div id="description">
|
|
84
|
-
<p>
|
|
85
|
-
This is an internal data structure class for the <a href="LSI.html">LSI</a>
|
|
86
|
-
node. Save for <a href="ContentNode.html#M000049">raw_vector_with</a>, it
|
|
87
|
-
should be fairly straightforward to understand. You should never have to
|
|
88
|
-
use it directly.
|
|
89
|
-
</p>
|
|
90
|
-
|
|
91
|
-
</div>
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
</div>
|
|
95
|
-
|
|
96
|
-
<div id="method-list">
|
|
97
|
-
<h3 class="section-bar">Methods</h3>
|
|
98
|
-
|
|
99
|
-
<div class="name-list">
|
|
100
|
-
<a href="#M000046">new</a>
|
|
101
|
-
<a href="#M000049">raw_vector_with</a>
|
|
102
|
-
<a href="#M000048">search_norm</a>
|
|
103
|
-
<a href="#M000047">search_vector</a>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
|
|
107
|
-
</div>
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
<!-- if includes -->
|
|
111
|
-
|
|
112
|
-
<div id="section">
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<div id="attribute-list">
|
|
119
|
-
<h3 class="section-bar">Attributes</h3>
|
|
120
|
-
|
|
121
|
-
<div class="name-list">
|
|
122
|
-
<table>
|
|
123
|
-
<tr class="top-aligned-row context-row">
|
|
124
|
-
<td class="context-item-name">categories</td>
|
|
125
|
-
<td class="context-item-value"> [RW] </td>
|
|
126
|
-
<td class="context-item-desc"></td>
|
|
127
|
-
</tr>
|
|
128
|
-
<tr class="top-aligned-row context-row">
|
|
129
|
-
<td class="context-item-name">lsi_norm</td>
|
|
130
|
-
<td class="context-item-value"> [RW] </td>
|
|
131
|
-
<td class="context-item-desc"></td>
|
|
132
|
-
</tr>
|
|
133
|
-
<tr class="top-aligned-row context-row">
|
|
134
|
-
<td class="context-item-name">lsi_vector</td>
|
|
135
|
-
<td class="context-item-value"> [RW] </td>
|
|
136
|
-
<td class="context-item-desc"></td>
|
|
137
|
-
</tr>
|
|
138
|
-
<tr class="top-aligned-row context-row">
|
|
139
|
-
<td class="context-item-name">raw_norm</td>
|
|
140
|
-
<td class="context-item-value"> [RW] </td>
|
|
141
|
-
<td class="context-item-desc"></td>
|
|
142
|
-
</tr>
|
|
143
|
-
<tr class="top-aligned-row context-row">
|
|
144
|
-
<td class="context-item-name">raw_vector</td>
|
|
145
|
-
<td class="context-item-value"> [RW] </td>
|
|
146
|
-
<td class="context-item-desc"></td>
|
|
147
|
-
</tr>
|
|
148
|
-
<tr class="top-aligned-row context-row">
|
|
149
|
-
<td class="context-item-name">word_hash</td>
|
|
150
|
-
<td class="context-item-value"> [R] </td>
|
|
151
|
-
<td class="context-item-desc"></td>
|
|
152
|
-
</tr>
|
|
153
|
-
</table>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
<!-- if method_list -->
|
|
160
|
-
<div id="methods">
|
|
161
|
-
<h3 class="section-bar">Public Class methods</h3>
|
|
162
|
-
|
|
163
|
-
<div id="method-M000046" class="method-detail">
|
|
164
|
-
<a name="M000046"></a>
|
|
165
|
-
|
|
166
|
-
<div class="method-heading">
|
|
167
|
-
<a href="ContentNode.src/M000046.html" target="Code" class="method-signature"
|
|
168
|
-
onclick="popupCode('ContentNode.src/M000046.html');return false;">
|
|
169
|
-
<span class="method-name">new</span><span class="method-args">( word_hash, *categories )</span>
|
|
170
|
-
</a>
|
|
171
|
-
</div>
|
|
172
|
-
|
|
173
|
-
<div class="method-description">
|
|
174
|
-
<p>
|
|
175
|
-
If text_proc is not specified, the source will be duck-typed via
|
|
176
|
-
source.to_s
|
|
177
|
-
</p>
|
|
178
|
-
</div>
|
|
179
|
-
</div>
|
|
180
|
-
|
|
181
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
|
182
|
-
|
|
183
|
-
<div id="method-M000049" class="method-detail">
|
|
184
|
-
<a name="M000049"></a>
|
|
185
|
-
|
|
186
|
-
<div class="method-heading">
|
|
187
|
-
<a href="ContentNode.src/M000049.html" target="Code" class="method-signature"
|
|
188
|
-
onclick="popupCode('ContentNode.src/M000049.html');return false;">
|
|
189
|
-
<span class="method-name">raw_vector_with</span><span class="method-args">( word_list )</span>
|
|
190
|
-
</a>
|
|
191
|
-
</div>
|
|
192
|
-
|
|
193
|
-
<div class="method-description">
|
|
194
|
-
<p>
|
|
195
|
-
Creates the raw vector out of word_hash using word_list as the key for
|
|
196
|
-
mapping the vector space.
|
|
197
|
-
</p>
|
|
198
|
-
</div>
|
|
199
|
-
</div>
|
|
200
|
-
|
|
201
|
-
<div id="method-M000048" class="method-detail">
|
|
202
|
-
<a name="M000048"></a>
|
|
203
|
-
|
|
204
|
-
<div class="method-heading">
|
|
205
|
-
<a href="ContentNode.src/M000048.html" target="Code" class="method-signature"
|
|
206
|
-
onclick="popupCode('ContentNode.src/M000048.html');return false;">
|
|
207
|
-
<span class="method-name">search_norm</span><span class="method-args">()</span>
|
|
208
|
-
</a>
|
|
209
|
-
</div>
|
|
210
|
-
|
|
211
|
-
<div class="method-description">
|
|
212
|
-
<p>
|
|
213
|
-
Use this to fetch the appropriate search vector in normalized form.
|
|
214
|
-
</p>
|
|
215
|
-
</div>
|
|
216
|
-
</div>
|
|
217
|
-
|
|
218
|
-
<div id="method-M000047" class="method-detail">
|
|
219
|
-
<a name="M000047"></a>
|
|
220
|
-
|
|
221
|
-
<div class="method-heading">
|
|
222
|
-
<a href="ContentNode.src/M000047.html" target="Code" class="method-signature"
|
|
223
|
-
onclick="popupCode('ContentNode.src/M000047.html');return false;">
|
|
224
|
-
<span class="method-name">search_vector</span><span class="method-args">()</span>
|
|
225
|
-
</a>
|
|
226
|
-
</div>
|
|
227
|
-
|
|
228
|
-
<div class="method-description">
|
|
229
|
-
<p>
|
|
230
|
-
Use this to fetch the appropriate search vector.
|
|
231
|
-
</p>
|
|
232
|
-
</div>
|
|
233
|
-
</div>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
</div>
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
<div id="validator-badges">
|
|
243
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
244
|
-
</div>
|
|
245
|
-
|
|
246
|
-
</body>
|
|
247
|
-
</html>
|
|
@@ -1,19 +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>new (Classifier::ContentNode)</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/lsi/content_node.rb, line 18</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">word_hash</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">categories</span> )
|
|
15
|
-
<span class="ruby-ivar">@categories</span> = <span class="ruby-identifier">categories</span> <span class="ruby-operator">||</span> []
|
|
16
|
-
<span class="ruby-ivar">@word_hash</span> = <span class="ruby-identifier">word_hash</span>
|
|
17
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
18
|
-
</body>
|
|
19
|
-
</html>
|
|
@@ -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>search_vector (Classifier::ContentNode)</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/lsi/content_node.rb, line 24</span>
|
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search_vector</span>
|
|
15
|
-
<span class="ruby-ivar">@lsi_vector</span> <span class="ruby-operator">||</span> <span class="ruby-ivar">@raw_vector</span>
|
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
|
17
|
-
</body>
|
|
18
|
-
</html>
|