classifier 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- 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::LSI)</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.rb, line 35</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
15
|
-
<span class="ruby-ivar">@auto_rebuild</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:auto_rebuild</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span>
|
16
|
-
<span class="ruby-ivar">@word_list</span>, <span class="ruby-ivar">@items</span> = <span class="ruby-constant">WordList</span>.<span class="ruby-identifier">new</span>, {}
|
17
|
-
<span class="ruby-ivar">@version</span>, <span class="ruby-ivar">@built_at_version</span> = <span class="ruby-value">0</span>, <span class="ruby-value">-1</span>
|
18
|
-
<span class="ruby-keyword kw">end</span></pre>
|
19
|
-
</body>
|
20
|
-
</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>needs_rebuild? (Classifier::LSI)</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.rb, line 44</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">needs_rebuild?</span>
|
15
|
-
(<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>) <span class="ruby-operator">&&</span> (<span class="ruby-ivar">@version</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@built_at_version</span>)
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,21 +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_item (Classifier::LSI)</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.rb, line 61</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">add_item</span>( <span class="ruby-identifier">item</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">categories</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
<span class="ruby-identifier">clean_word_hash</span> = <span class="ruby-identifier">block</span> <span class="ruby-value">? </span><span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">item</span>).<span class="ruby-identifier">clean_word_hash</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">item</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">clean_word_hash</span>
|
16
|
-
<span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>] = <span class="ruby-constant">ContentNode</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">clean_word_hash</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">categories</span>)
|
17
|
-
<span class="ruby-ivar">@version</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
18
|
-
<span class="ruby-identifier">build_index</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@auto_rebuild</span>
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</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><< (Classifier::LSI)</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.rb, line 72</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-operator"><<</span>( <span class="ruby-identifier">item</span> )
|
15
|
-
<span class="ruby-identifier">add_item</span> <span class="ruby-identifier">item</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</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>categories_for (Classifier::LSI)</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.rb, line 78</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">categories_for</span>(<span class="ruby-identifier">item</span>)
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>]
|
16
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">categories</span>
|
17
|
-
<span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,21 +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>remove_item (Classifier::LSI)</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.rb, line 85</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_item</span>( <span class="ruby-identifier">item</span> )
|
15
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">contain?</span> <span class="ruby-identifier">item</span>
|
16
|
-
<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">remove</span> <span class="ruby-identifier">item</span>
|
17
|
-
<span class="ruby-ivar">@version</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
18
|
-
<span class="ruby-keyword kw">end</span>
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</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>items (Classifier::LSI)</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.rb, line 93</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">items</span>
|
15
|
-
<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">keys</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</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>categories_for (Classifier::LSI)</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.rb, line 99</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">categories_for</span>(<span class="ruby-identifier">item</span>)
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>]
|
16
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">categories</span>
|
17
|
-
<span class="ruby-keyword kw">end</span></pre>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1,43 +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>build_index (Classifier::LSI)</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.rb, line 118</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_index</span>( <span class="ruby-identifier">cutoff</span>=<span class="ruby-value">0</span><span class="ruby-value">.75</span> )
|
15
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">needs_rebuild?</span>
|
16
|
-
<span class="ruby-identifier">make_word_list</span>
|
17
|
-
|
18
|
-
<span class="ruby-identifier">doc_list</span> = <span class="ruby-ivar">@items</span>.<span class="ruby-identifier">values</span>
|
19
|
-
<span class="ruby-identifier">tda</span> = <span class="ruby-identifier">doc_list</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">node</span><span class="ruby-operator">|</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">raw_vector_with</span>( <span class="ruby-ivar">@word_list</span> ) }
|
20
|
-
|
21
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$GSL</span>
|
22
|
-
<span class="ruby-identifier">tdm</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Matrix</span>.<span class="ruby-identifier">new</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">tda</span>).<span class="ruby-identifier">trans</span>
|
23
|
-
<span class="ruby-identifier">ntdm</span> = <span class="ruby-identifier">build_reduced_matrix</span>(<span class="ruby-identifier">tdm</span>, <span class="ruby-identifier">cutoff</span>)
|
24
|
-
|
25
|
-
<span class="ruby-identifier">ntdm</span>.<span class="ruby-identifier">size</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
|
26
|
-
<span class="ruby-identifier">vec</span> = <span class="ruby-constant">GSL</span><span class="ruby-operator">::</span><span class="ruby-constant">Vector</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">ntdm</span>.<span class="ruby-identifier">column</span>(<span class="ruby-identifier">col</span>) ).<span class="ruby-identifier">row</span>
|
27
|
-
<span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>].<span class="ruby-identifier">lsi_vector</span> = <span class="ruby-identifier">vec</span>
|
28
|
-
<span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>].<span class="ruby-identifier">lsi_norm</span> = <span class="ruby-identifier">vec</span>.<span class="ruby-identifier">normalize</span>
|
29
|
-
<span class="ruby-keyword kw">end</span>
|
30
|
-
<span class="ruby-keyword kw">else</span>
|
31
|
-
<span class="ruby-identifier">tdm</span> = <span class="ruby-constant">Matrix</span>.<span class="ruby-identifier">rows</span>(<span class="ruby-identifier">tda</span>).<span class="ruby-identifier">trans</span>
|
32
|
-
<span class="ruby-identifier">ntdm</span> = <span class="ruby-identifier">build_reduced_matrix</span>(<span class="ruby-identifier">tdm</span>, <span class="ruby-identifier">cutoff</span>)
|
33
|
-
|
34
|
-
<span class="ruby-identifier">ntdm</span>.<span class="ruby-identifier">row_size</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">col</span><span class="ruby-operator">|</span>
|
35
|
-
<span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>].<span class="ruby-identifier">lsi_vector</span> = <span class="ruby-identifier">ntdm</span>.<span class="ruby-identifier">column</span>(<span class="ruby-identifier">col</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>]
|
36
|
-
<span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>].<span class="ruby-identifier">lsi_norm</span> = <span class="ruby-identifier">ntdm</span>.<span class="ruby-identifier">column</span>(<span class="ruby-identifier">col</span>).<span class="ruby-identifier">normalize</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">doc_list</span>[<span class="ruby-identifier">col</span>]
|
37
|
-
<span class="ruby-keyword kw">end</span>
|
38
|
-
<span class="ruby-keyword kw">end</span>
|
39
|
-
|
40
|
-
<span class="ruby-ivar">@built_at_version</span> = <span class="ruby-ivar">@version</span>
|
41
|
-
<span class="ruby-keyword kw">end</span></pre>
|
42
|
-
</body>
|
43
|
-
</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>highest_relative_content (Classifier::LSI)</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.rb, line 155</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">highest_relative_content</span>( <span class="ruby-identifier">max_chunks</span>=<span class="ruby-value">10</span> )
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs_rebuild?</span>
|
16
|
-
|
17
|
-
<span class="ruby-identifier">avg_density</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
|
18
|
-
<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">each_key</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">avg_density</span>[<span class="ruby-identifier">x</span>] = <span class="ruby-identifier">proximity_array_for_content</span>(<span class="ruby-identifier">x</span>).<span class="ruby-identifier">inject</span>(<span class="ruby-value">0</span><span class="ruby-value">.0</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">y</span>[<span class="ruby-value">1</span>]} }
|
19
|
-
|
20
|
-
<span class="ruby-identifier">avg_density</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">avg_density</span>[<span class="ruby-identifier">x</span>] }.<span class="ruby-identifier">reverse</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">max_chunks</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>].<span class="ruby-identifier">map</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>proximity_array_for_content (Classifier::LSI)</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.rb, line 176</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">proximity_array_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs_rebuild?</span>
|
16
|
-
|
17
|
-
<span class="ruby-identifier">content_node</span> = <span class="ruby-identifier">node_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
18
|
-
<span class="ruby-identifier">result</span> =
|
19
|
-
<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
20
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$GSL</span>
|
21
|
-
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">content_node</span>.<span class="ruby-identifier">search_vector</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">search_vector</span>.<span class="ruby-identifier">col</span>
|
22
|
-
<span class="ruby-keyword kw">else</span>
|
23
|
-
<span class="ruby-identifier">val</span> = (<span class="ruby-constant">Matrix</span>[<span class="ruby-identifier">content_node</span>.<span class="ruby-identifier">search_vector</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">search_vector</span>)[<span class="ruby-value">0</span>]
|
24
|
-
<span class="ruby-keyword kw">end</span>
|
25
|
-
[<span class="ruby-identifier">item</span>, <span class="ruby-identifier">val</span>]
|
26
|
-
<span class="ruby-keyword kw">end</span>
|
27
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>] }.<span class="ruby-identifier">reverse</span>
|
28
|
-
<span class="ruby-keyword kw">end</span></pre>
|
29
|
-
</body>
|
30
|
-
</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>proximity_norms_for_content (Classifier::LSI)</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.rb, line 197</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">proximity_norms_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs_rebuild?</span>
|
16
|
-
|
17
|
-
<span class="ruby-identifier">content_node</span> = <span class="ruby-identifier">node_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
18
|
-
<span class="ruby-identifier">result</span> =
|
19
|
-
<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
|
20
|
-
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$GSL</span>
|
21
|
-
<span class="ruby-identifier">val</span> = <span class="ruby-identifier">content_node</span>.<span class="ruby-identifier">search_norm</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">search_norm</span>.<span class="ruby-identifier">col</span>
|
22
|
-
<span class="ruby-keyword kw">else</span>
|
23
|
-
<span class="ruby-identifier">val</span> = (<span class="ruby-constant">Matrix</span>[<span class="ruby-identifier">content_node</span>.<span class="ruby-identifier">search_norm</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">item</span>].<span class="ruby-identifier">search_norm</span>)[<span class="ruby-value">0</span>]
|
24
|
-
<span class="ruby-keyword kw">end</span>
|
25
|
-
[<span class="ruby-identifier">item</span>, <span class="ruby-identifier">val</span>]
|
26
|
-
<span class="ruby-keyword kw">end</span>
|
27
|
-
<span class="ruby-identifier">result</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">1</span>] }.<span class="ruby-identifier">reverse</span>
|
28
|
-
<span class="ruby-keyword kw">end</span></pre>
|
29
|
-
</body>
|
30
|
-
</html>
|
@@ -1,21 +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 (Classifier::LSI)</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.rb, line 220</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">search</span>( <span class="ruby-identifier">string</span>, <span class="ruby-identifier">max_nearest</span>=<span class="ruby-value">3</span> )
|
15
|
-
<span class="ruby-keyword kw">return</span> [] <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs_rebuild?</span>
|
16
|
-
<span class="ruby-identifier">carry</span> = <span class="ruby-identifier">proximity_norms_for_content</span>( <span class="ruby-identifier">string</span> )
|
17
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">carry</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">0</span>] }
|
18
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">max_nearest</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,21 +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>find_related (Classifier::LSI)</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.rb, line 236</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_related</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-identifier">max_nearest</span>=<span class="ruby-value">3</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
<span class="ruby-identifier">carry</span> =
|
16
|
-
<span class="ruby-identifier">proximity_array_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> ).<span class="ruby-identifier">reject</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">doc</span> }
|
17
|
-
<span class="ruby-identifier">result</span> = <span class="ruby-identifier">carry</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">x</span>[<span class="ruby-value">0</span>] }
|
18
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">max_nearest</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,31 +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::LSI)</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.rb, line 252</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">classify</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-identifier">cutoff</span>=<span class="ruby-value">0</span><span class="ruby-value">.30</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
15
|
-
<span class="ruby-identifier">icutoff</span> = (<span class="ruby-ivar">@items</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">*</span> <span class="ruby-identifier">cutoff</span>).<span class="ruby-identifier">round</span>
|
16
|
-
<span class="ruby-identifier">carry</span> = <span class="ruby-identifier">proximity_array_for_content</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">block</span> )
|
17
|
-
<span class="ruby-identifier">carry</span> = <span class="ruby-identifier">carry</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">icutoff</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
18
|
-
<span class="ruby-identifier">votes</span> = {}
|
19
|
-
<span class="ruby-identifier">carry</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span>
|
20
|
-
<span class="ruby-identifier">categories</span> = <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">pair</span>[<span class="ruby-value">0</span>]].<span class="ruby-identifier">categories</span>
|
21
|
-
<span class="ruby-identifier">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-operator">|</span>
|
22
|
-
<span class="ruby-identifier">votes</span>[<span class="ruby-identifier">category</span>] <span class="ruby-operator">||=</span> <span class="ruby-value">0</span><span class="ruby-value">.0</span>
|
23
|
-
<span class="ruby-identifier">votes</span>[<span class="ruby-identifier">category</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">pair</span>[<span class="ruby-value">1</span>]
|
24
|
-
<span class="ruby-keyword kw">end</span>
|
25
|
-
<span class="ruby-keyword kw">end</span>
|
26
|
-
|
27
|
-
<span class="ruby-identifier">ranking</span> = <span class="ruby-identifier">votes</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort_by</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">votes</span>[<span class="ruby-identifier">x</span>] }
|
28
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ranking</span>[<span class="ruby-value">-1</span>]
|
29
|
-
<span class="ruby-keyword kw">end</span></pre>
|
30
|
-
</body>
|
31
|
-
</html>
|
@@ -1,21 +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>highest_ranked_stems (Classifier::LSI)</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.rb, line 272</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">highest_ranked_stems</span>( <span class="ruby-identifier">doc</span>, <span class="ruby-identifier">count</span>=<span class="ruby-value">3</span> )
|
15
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-value str">"Requested stem ranking on non-indexed content!"</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@items</span>[<span class="ruby-identifier">doc</span>]
|
16
|
-
<span class="ruby-identifier">arr</span> = <span class="ruby-identifier">node_for_content</span>(<span class="ruby-identifier">doc</span>).<span class="ruby-identifier">lsi_vector</span>.<span class="ruby-identifier">to_a</span>
|
17
|
-
<span class="ruby-identifier">top_n</span> = <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">reverse</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">count</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
|
18
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">top_n</span>.<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@word_list</span>.<span class="ruby-identifier">word_for_index</span>(<span class="ruby-identifier">arr</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">x</span>))}
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,217 +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::WordList</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::WordList</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/classifier/lsi/word_list_rb.html">
|
59
|
-
lib/classifier/lsi/word_list.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 class keeps a word => index mapping. It is used to map stemmed
|
86
|
-
words to dimensions of a vector.
|
87
|
-
</p>
|
88
|
-
|
89
|
-
</div>
|
90
|
-
|
91
|
-
|
92
|
-
</div>
|
93
|
-
|
94
|
-
<div id="method-list">
|
95
|
-
<h3 class="section-bar">Methods</h3>
|
96
|
-
|
97
|
-
<div class="name-list">
|
98
|
-
<a href="#M000019">[]</a>
|
99
|
-
<a href="#M000018">add_word</a>
|
100
|
-
<a href="#M000017">new</a>
|
101
|
-
<a href="#M000021">size</a>
|
102
|
-
<a href="#M000020">word_for_index</a>
|
103
|
-
</div>
|
104
|
-
</div>
|
105
|
-
|
106
|
-
</div>
|
107
|
-
|
108
|
-
|
109
|
-
<!-- if includes -->
|
110
|
-
|
111
|
-
<div id="section">
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
<!-- if method_list -->
|
121
|
-
<div id="methods">
|
122
|
-
<h3 class="section-bar">Public Class methods</h3>
|
123
|
-
|
124
|
-
<div id="method-M000017" class="method-detail">
|
125
|
-
<a name="M000017"></a>
|
126
|
-
|
127
|
-
<div class="method-heading">
|
128
|
-
<a href="WordList.src/M000017.html" target="Code" class="method-signature"
|
129
|
-
onclick="popupCode('WordList.src/M000017.html');return false;">
|
130
|
-
<span class="method-name">new</span><span class="method-args">()</span>
|
131
|
-
</a>
|
132
|
-
</div>
|
133
|
-
|
134
|
-
<div class="method-description">
|
135
|
-
</div>
|
136
|
-
</div>
|
137
|
-
|
138
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
139
|
-
|
140
|
-
<div id="method-M000019" class="method-detail">
|
141
|
-
<a name="M000019"></a>
|
142
|
-
|
143
|
-
<div class="method-heading">
|
144
|
-
<a href="WordList.src/M000019.html" target="Code" class="method-signature"
|
145
|
-
onclick="popupCode('WordList.src/M000019.html');return false;">
|
146
|
-
<span class="method-name">[]</span><span class="method-args">(lookup)</span>
|
147
|
-
</a>
|
148
|
-
</div>
|
149
|
-
|
150
|
-
<div class="method-description">
|
151
|
-
<p>
|
152
|
-
Returns the dimension of the word or nil if the word is not in the space.
|
153
|
-
</p>
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
|
157
|
-
<div id="method-M000018" class="method-detail">
|
158
|
-
<a name="M000018"></a>
|
159
|
-
|
160
|
-
<div class="method-heading">
|
161
|
-
<a href="WordList.src/M000018.html" target="Code" class="method-signature"
|
162
|
-
onclick="popupCode('WordList.src/M000018.html');return false;">
|
163
|
-
<span class="method-name">add_word</span><span class="method-args">(word)</span>
|
164
|
-
</a>
|
165
|
-
</div>
|
166
|
-
|
167
|
-
<div class="method-description">
|
168
|
-
<p>
|
169
|
-
Adds a word (if it is new) and assigns it a unique dimension.
|
170
|
-
</p>
|
171
|
-
</div>
|
172
|
-
</div>
|
173
|
-
|
174
|
-
<div id="method-M000021" class="method-detail">
|
175
|
-
<a name="M000021"></a>
|
176
|
-
|
177
|
-
<div class="method-heading">
|
178
|
-
<a href="WordList.src/M000021.html" target="Code" class="method-signature"
|
179
|
-
onclick="popupCode('WordList.src/M000021.html');return false;">
|
180
|
-
<span class="method-name">size</span><span class="method-args">()</span>
|
181
|
-
</a>
|
182
|
-
</div>
|
183
|
-
|
184
|
-
<div class="method-description">
|
185
|
-
<p>
|
186
|
-
Returns the number of words mapped.
|
187
|
-
</p>
|
188
|
-
</div>
|
189
|
-
</div>
|
190
|
-
|
191
|
-
<div id="method-M000020" class="method-detail">
|
192
|
-
<a name="M000020"></a>
|
193
|
-
|
194
|
-
<div class="method-heading">
|
195
|
-
<a href="WordList.src/M000020.html" target="Code" class="method-signature"
|
196
|
-
onclick="popupCode('WordList.src/M000020.html');return false;">
|
197
|
-
<span class="method-name">word_for_index</span><span class="method-args">(ind)</span>
|
198
|
-
</a>
|
199
|
-
</div>
|
200
|
-
|
201
|
-
<div class="method-description">
|
202
|
-
</div>
|
203
|
-
</div>
|
204
|
-
|
205
|
-
|
206
|
-
</div>
|
207
|
-
|
208
|
-
|
209
|
-
</div>
|
210
|
-
|
211
|
-
|
212
|
-
<div id="validator-badges">
|
213
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
214
|
-
</div>
|
215
|
-
|
216
|
-
</body>
|
217
|
-
</html>
|