tyccl_tim_fixed 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/.gitignore +17 -0
  2. data/Gemfile +6 -0
  3. data/LICENSE +20 -0
  4. data/README.md +75 -0
  5. data/Rakefile +11 -0
  6. data/doc/Object.html +154 -0
  7. data/doc/README_md.html +182 -0
  8. data/doc/Tyccl/Containers.html +130 -0
  9. data/doc/Tyccl/Logger.html +130 -0
  10. data/doc/Tyccl/YAML.html +130 -0
  11. data/doc/Tyccl.html +1020 -0
  12. data/doc/created.rid +3 -0
  13. data/doc/images/add.png +0 -0
  14. data/doc/images/arrow_up.png +0 -0
  15. data/doc/images/brick.png +0 -0
  16. data/doc/images/brick_link.png +0 -0
  17. data/doc/images/bug.png +0 -0
  18. data/doc/images/bullet_black.png +0 -0
  19. data/doc/images/bullet_toggle_minus.png +0 -0
  20. data/doc/images/bullet_toggle_plus.png +0 -0
  21. data/doc/images/date.png +0 -0
  22. data/doc/images/delete.png +0 -0
  23. data/doc/images/find.png +0 -0
  24. data/doc/images/loadingAnimation.gif +0 -0
  25. data/doc/images/macFFBgHack.png +0 -0
  26. data/doc/images/package.png +0 -0
  27. data/doc/images/page_green.png +0 -0
  28. data/doc/images/page_white_text.png +0 -0
  29. data/doc/images/page_white_width.png +0 -0
  30. data/doc/images/plugin.png +0 -0
  31. data/doc/images/ruby.png +0 -0
  32. data/doc/images/tag_blue.png +0 -0
  33. data/doc/images/tag_green.png +0 -0
  34. data/doc/images/transparent.png +0 -0
  35. data/doc/images/wrench.png +0 -0
  36. data/doc/images/wrench_orange.png +0 -0
  37. data/doc/images/zoom.png +0 -0
  38. data/doc/index.html +166 -0
  39. data/doc/js/darkfish.js +155 -0
  40. data/doc/js/jquery.js +18 -0
  41. data/doc/js/navigation.js +142 -0
  42. data/doc/js/search.js +94 -0
  43. data/doc/js/search_index.js +1 -0
  44. data/doc/js/searcher.js +228 -0
  45. data/doc/rdoc.css +595 -0
  46. data/doc/table_of_contents.html +111 -0
  47. data/lib/Inverted.yaml +77458 -0
  48. data/lib/cilin.txt +17817 -0
  49. data/lib/tyccl/version.rb +3 -0
  50. data/lib/tyccl.rb +371 -0
  51. data/test/test_tyccl.rb +151 -0
  52. data/tyccl.gemspec +23 -0
  53. metadata +133 -0
@@ -0,0 +1,130 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module Tyccl::Containers - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/tyccl.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+
62
+
63
+
64
+
65
+ </div>
66
+
67
+ <div id="project-metadata">
68
+ <nav id="fileindex-section" class="section project-section">
69
+ <h3 class="section-header">Pages</h3>
70
+
71
+ <ul>
72
+
73
+ <li class="file"><a href="../README_md.html">README</a>
74
+
75
+ </ul>
76
+ </nav>
77
+
78
+ <nav id="classindex-section" class="section project-section">
79
+ <h3 class="section-header">Class and Module Index</h3>
80
+
81
+ <ul class="link-list">
82
+
83
+ <li><a href="../Object.html">Object</a>
84
+
85
+ <li><a href="../Tyccl.html">Tyccl</a>
86
+
87
+ <li><a href="../Tyccl/Containers.html">Tyccl::Containers</a>
88
+
89
+ <li><a href="../Tyccl/Logger.html">Tyccl::Logger</a>
90
+
91
+ <li><a href="../Tyccl/YAML.html">Tyccl::YAML</a>
92
+
93
+ </ul>
94
+ </nav>
95
+
96
+ </div>
97
+ </nav>
98
+
99
+ <div id="documentation">
100
+ <h1 class="module">module Tyccl::Containers</h1>
101
+
102
+ <div id="description" class="description">
103
+
104
+ </div><!-- description -->
105
+
106
+
107
+
108
+
109
+ <section id="5Buntitled-5D" class="documentation-section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- Methods -->
119
+
120
+ </section><!-- 5Buntitled-5D -->
121
+
122
+ </div><!-- documentation -->
123
+
124
+
125
+ <footer id="validator-badges">
126
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
127
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
128
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
129
+ </footer>
130
+
@@ -0,0 +1,130 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module Tyccl::Logger - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/tyccl.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+
62
+
63
+
64
+
65
+ </div>
66
+
67
+ <div id="project-metadata">
68
+ <nav id="fileindex-section" class="section project-section">
69
+ <h3 class="section-header">Pages</h3>
70
+
71
+ <ul>
72
+
73
+ <li class="file"><a href="../README_md.html">README</a>
74
+
75
+ </ul>
76
+ </nav>
77
+
78
+ <nav id="classindex-section" class="section project-section">
79
+ <h3 class="section-header">Class and Module Index</h3>
80
+
81
+ <ul class="link-list">
82
+
83
+ <li><a href="../Object.html">Object</a>
84
+
85
+ <li><a href="../Tyccl.html">Tyccl</a>
86
+
87
+ <li><a href="../Tyccl/Containers.html">Tyccl::Containers</a>
88
+
89
+ <li><a href="../Tyccl/Logger.html">Tyccl::Logger</a>
90
+
91
+ <li><a href="../Tyccl/YAML.html">Tyccl::YAML</a>
92
+
93
+ </ul>
94
+ </nav>
95
+
96
+ </div>
97
+ </nav>
98
+
99
+ <div id="documentation">
100
+ <h1 class="module">module Tyccl::Logger</h1>
101
+
102
+ <div id="description" class="description">
103
+
104
+ </div><!-- description -->
105
+
106
+
107
+
108
+
109
+ <section id="5Buntitled-5D" class="documentation-section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- Methods -->
119
+
120
+ </section><!-- 5Buntitled-5D -->
121
+
122
+ </div><!-- documentation -->
123
+
124
+
125
+ <footer id="validator-badges">
126
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
127
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
128
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
129
+ </footer>
130
+
@@ -0,0 +1,130 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>module Tyccl::YAML - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="../rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "../";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="../js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="../js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="../js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="../js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="../js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="module">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="../index.html">Home</a>
28
+ <a href="../table_of_contents.html#classes">Classes</a>
29
+ <a href="../table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/tyccl.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+
62
+
63
+
64
+
65
+ </div>
66
+
67
+ <div id="project-metadata">
68
+ <nav id="fileindex-section" class="section project-section">
69
+ <h3 class="section-header">Pages</h3>
70
+
71
+ <ul>
72
+
73
+ <li class="file"><a href="../README_md.html">README</a>
74
+
75
+ </ul>
76
+ </nav>
77
+
78
+ <nav id="classindex-section" class="section project-section">
79
+ <h3 class="section-header">Class and Module Index</h3>
80
+
81
+ <ul class="link-list">
82
+
83
+ <li><a href="../Object.html">Object</a>
84
+
85
+ <li><a href="../Tyccl.html">Tyccl</a>
86
+
87
+ <li><a href="../Tyccl/Containers.html">Tyccl::Containers</a>
88
+
89
+ <li><a href="../Tyccl/Logger.html">Tyccl::Logger</a>
90
+
91
+ <li><a href="../Tyccl/YAML.html">Tyccl::YAML</a>
92
+
93
+ </ul>
94
+ </nav>
95
+
96
+ </div>
97
+ </nav>
98
+
99
+ <div id="documentation">
100
+ <h1 class="module">module Tyccl::YAML</h1>
101
+
102
+ <div id="description" class="description">
103
+
104
+ </div><!-- description -->
105
+
106
+
107
+
108
+
109
+ <section id="5Buntitled-5D" class="documentation-section">
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+
118
+ <!-- Methods -->
119
+
120
+ </section><!-- 5Buntitled-5D -->
121
+
122
+ </div><!-- documentation -->
123
+
124
+
125
+ <footer id="validator-badges">
126
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
127
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
128
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
129
+ </footer>
130
+
data/doc/Tyccl.html ADDED
@@ -0,0 +1,1020 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html>
4
+ <head>
5
+ <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
6
+
7
+ <title>class Tyccl - RDoc Documentation</title>
8
+
9
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
10
+
11
+ <script type="text/javascript">
12
+ var rdoc_rel_prefix = "./";
13
+ </script>
14
+
15
+ <script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
16
+ <script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
17
+ <script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
18
+ <script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
19
+ <script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
20
+ <script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
21
+
22
+
23
+ <body id="top" class="class">
24
+ <nav id="metadata">
25
+ <nav id="home-section" class="section">
26
+ <h3 class="section-header">
27
+ <a href="./index.html">Home</a>
28
+ <a href="./table_of_contents.html#classes">Classes</a>
29
+ <a href="./table_of_contents.html#methods">Methods</a>
30
+ </h3>
31
+ </nav>
32
+
33
+
34
+ <nav id="search-section" class="section project-section" class="initially-hidden">
35
+ <form action="#" method="get" accept-charset="utf-8">
36
+ <h3 class="section-header">
37
+ <input type="text" name="search" placeholder="Search" id="search-field"
38
+ title="Type to search, Up and Down to navigate, Enter to load">
39
+ </h3>
40
+ </form>
41
+
42
+ <ul id="search-results" class="initially-hidden"></ul>
43
+ </nav>
44
+
45
+
46
+
47
+
48
+ <div id="file-metadata">
49
+ <nav id="file-list-section" class="section">
50
+ <h3 class="section-header">Defined In</h3>
51
+ <ul>
52
+ <li>lib/tyccl.rb
53
+ </ul>
54
+ </nav>
55
+
56
+
57
+ </div>
58
+
59
+ <div id="class-metadata">
60
+
61
+ <nav id="parent-class-section" class="section">
62
+ <h3 class="section-header">Parent</h3>
63
+
64
+ <p class="link"><a href="Object.html">Object</a>
65
+
66
+ </nav>
67
+
68
+
69
+
70
+ <!-- Method Quickref -->
71
+ <nav id="method-list-section" class="section">
72
+ <h3 class="section-header">Methods</h3>
73
+
74
+ <ul class="link-list">
75
+
76
+ <li ><a href="#method-c-combine_id">::combine_id</a>
77
+
78
+ <li ><a href="#method-c-compare_id">::compare_id</a>
79
+
80
+ <li ><a href="#method-c-cut_id">::cut_id</a>
81
+
82
+ <li ><a href="#method-c-dist">::dist</a>
83
+
84
+ <li ><a href="#method-c-gen_findstring">::gen_findstring</a>
85
+
86
+ <li ><a href="#method-c-get_dist_by_id">::get_dist_by_id</a>
87
+
88
+ <li ><a href="#method-c-get_equal">::get_equal</a>
89
+
90
+ <li ><a href="#method-c-get_id_sum">::get_id_sum</a>
91
+
92
+ <li ><a href="#method-c-get_ids_by_wildcard">::get_ids_by_wildcard</a>
93
+
94
+ <li ><a href="#method-c-get_ids_by_word">::get_ids_by_word</a>
95
+
96
+ <li ><a href="#method-c-get_index_sum">::get_index_sum</a>
97
+
98
+ <li ><a href="#method-c-get_same">::get_same</a>
99
+
100
+ <li ><a href="#method-c-get_sim_by_id">::get_sim_by_id</a>
101
+
102
+ <li ><a href="#method-c-get_similar">::get_similar</a>
103
+
104
+ <li ><a href="#method-c-get_words_by_id">::get_words_by_id</a>
105
+
106
+ <li ><a href="#method-c-has_equal-3F">::has_equal?</a>
107
+
108
+ <li ><a href="#method-c-has_same-3F">::has_same?</a>
109
+
110
+ <li ><a href="#method-c-has_single-3F">::has_single?</a>
111
+
112
+ <li ><a href="#method-c-sim">::sim</a>
113
+
114
+ </ul>
115
+ </nav>
116
+
117
+ </div>
118
+
119
+ <div id="project-metadata">
120
+ <nav id="fileindex-section" class="section project-section">
121
+ <h3 class="section-header">Pages</h3>
122
+
123
+ <ul>
124
+
125
+ <li class="file"><a href="./README_md.html">README</a>
126
+
127
+ </ul>
128
+ </nav>
129
+
130
+ <nav id="classindex-section" class="section project-section">
131
+ <h3 class="section-header">Class and Module Index</h3>
132
+
133
+ <ul class="link-list">
134
+
135
+ <li><a href="./Object.html">Object</a>
136
+
137
+ <li><a href="./Tyccl.html">Tyccl</a>
138
+
139
+ <li><a href="./Tyccl/Containers.html">Tyccl::Containers</a>
140
+
141
+ <li><a href="./Tyccl/Logger.html">Tyccl::Logger</a>
142
+
143
+ <li><a href="./Tyccl/YAML.html">Tyccl::YAML</a>
144
+
145
+ </ul>
146
+ </nav>
147
+
148
+ </div>
149
+ </nav>
150
+
151
+ <div id="documentation">
152
+ <h1 class="class">class Tyccl</h1>
153
+
154
+ <div id="description" class="description">
155
+
156
+ <p>class <a href="Tyccl.html">Tyccl</a> is a singleton class, no Tyccl.new()
157
+ method instead of Tyccl.instance() to keep <a href="Tyccl.html">Tyccl</a>
158
+ object just only one.</p>
159
+
160
+ </div><!-- description -->
161
+
162
+
163
+
164
+
165
+ <section id="5Buntitled-5D" class="documentation-section">
166
+
167
+
168
+
169
+
170
+
171
+
172
+
173
+
174
+ <!-- Methods -->
175
+
176
+ <section id="public-class-5Buntitled-5D-method-details" class="method-section section">
177
+ <h3 class="section-header">Public Class Methods</h3>
178
+
179
+
180
+ <div id="method-c-combine_id" class="method-detail ">
181
+
182
+ <div class="method-heading">
183
+ <span class="method-name">combine_id</span><span
184
+ class="method-args">(frame)</span>
185
+
186
+ <span class="method-click-advice">click to toggle source</span>
187
+
188
+ </div>
189
+
190
+
191
+ <div class="method-description">
192
+
193
+ <p>the method cut_id`s inverse process.</p>
194
+
195
+
196
+
197
+
198
+ <div class="method-source-code" id="combine_id-source">
199
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 338</span>
200
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">combine_id</span>(<span class="ruby-identifier">frame</span>)
201
+ <span class="ruby-identifier">m</span>=<span class="ruby-string">&quot;&quot;</span>
202
+ <span class="ruby-identifier">frame</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">seg</span><span class="ruby-operator">|</span>
203
+ <span class="ruby-identifier">m</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">seg</span>
204
+ }
205
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">m</span>
206
+ <span class="ruby-keyword">end</span></pre>
207
+ </div><!-- combine_id-source -->
208
+
209
+ </div>
210
+
211
+
212
+
213
+
214
+ </div><!-- combine_id-method -->
215
+
216
+
217
+ <div id="method-c-compare_id" class="method-detail ">
218
+
219
+ <div class="method-heading">
220
+ <span class="method-name">compare_id</span><span
221
+ class="method-args">(idA, idB)</span>
222
+
223
+ <span class="method-click-advice">click to toggle source</span>
224
+
225
+ </div>
226
+
227
+
228
+ <div class="method-description">
229
+
230
+ <p>Given idA(string) and idB(string). Returns fisrt diffrent place of their
231
+ segment, place vlaues <a href="http://0,4">in</a>. if they are the same ,
232
+ returns 5.</p>
233
+
234
+
235
+
236
+
237
+ <div class="method-source-code" id="compare_id-source">
238
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 349</span>
239
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">compare_id</span>(<span class="ruby-identifier">idA</span>, <span class="ruby-identifier">idB</span>)
240
+ <span class="ruby-identifier">frameA</span>=<span class="ruby-identifier">cut_id</span>(<span class="ruby-identifier">idA</span>)
241
+ <span class="ruby-identifier">frameB</span>=<span class="ruby-identifier">cut_id</span>(<span class="ruby-identifier">idB</span>)
242
+ <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">frameA</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>){ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
243
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">frameA</span>[<span class="ruby-identifier">i</span>].<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">frameB</span>[<span class="ruby-identifier">i</span>]) <span class="ruby-operator">==</span> <span class="ruby-keyword">false</span>
244
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">i</span>
245
+ <span class="ruby-keyword">end</span>
246
+ }
247
+ <span class="ruby-keyword">return</span> <span class="ruby-value">5</span>
248
+ <span class="ruby-keyword">end</span></pre>
249
+ </div><!-- compare_id-source -->
250
+
251
+ </div>
252
+
253
+
254
+
255
+
256
+ </div><!-- compare_id-method -->
257
+
258
+
259
+ <div id="method-c-cut_id" class="method-detail ">
260
+
261
+ <div class="method-heading">
262
+ <span class="method-name">cut_id</span><span
263
+ class="method-args">(id)</span>
264
+
265
+ <span class="method-click-advice">click to toggle source</span>
266
+
267
+ </div>
268
+
269
+
270
+ <div class="method-description">
271
+
272
+ <p>Given a id(string). Returns an array that contains 5 strings which are ID`s
273
+ diffrent segment, like: A,a,01,A,01= .</p>
274
+
275
+
276
+
277
+
278
+ <div class="method-source-code" id="cut_id-source">
279
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 332</span>
280
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">cut_id</span>(<span class="ruby-identifier">id</span>)
281
+ <span class="ruby-identifier">frame</span>=[<span class="ruby-identifier">id</span>[<span class="ruby-value">0</span>],<span class="ruby-identifier">id</span>[<span class="ruby-value">1</span>],<span class="ruby-identifier">id</span>[<span class="ruby-value">2</span><span class="ruby-operator">..</span><span class="ruby-value">3</span>],<span class="ruby-identifier">id</span>[<span class="ruby-value">4</span>],<span class="ruby-identifier">id</span>[<span class="ruby-value">5</span><span class="ruby-operator">..</span><span class="ruby-value">7</span>]]
282
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">frame</span>
283
+ <span class="ruby-keyword">end</span></pre>
284
+ </div><!-- cut_id-source -->
285
+
286
+ </div>
287
+
288
+
289
+
290
+
291
+ </div><!-- cut_id-method -->
292
+
293
+
294
+ <div id="method-c-dist" class="method-detail ">
295
+
296
+ <div class="method-heading">
297
+ <span class="method-name">dist</span><span
298
+ class="method-args">(wordA, wordB)</span>
299
+
300
+ <span class="method-click-advice">click to toggle source</span>
301
+
302
+ </div>
303
+
304
+
305
+ <div class="method-description">
306
+
307
+ <p>Given wordA(string) and wordB(string). Returns a Struct Result_t which
308
+ contains idA, idB, and shortest semantic distance(int) between wordA and
309
+ wordB.</p>
310
+
311
+
312
+
313
+
314
+ <div class="method-source-code" id="dist-source">
315
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 253</span>
316
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">dist</span>(<span class="ruby-identifier">wordA</span>, <span class="ruby-identifier">wordB</span>)
317
+ <span class="ruby-identifier">alpha</span>=<span class="ruby-value">10.0</span><span class="ruby-operator">/</span><span class="ruby-value">5</span>
318
+ <span class="ruby-identifier">shortest_Pair</span> = <span class="ruby-constant">Result_t</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">100</span>,<span class="ruby-string">&quot;&quot;</span>,<span class="ruby-string">&quot;&quot;</span>)
319
+ <span class="ruby-identifier">idAs</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">wordA</span>)
320
+ <span class="ruby-identifier">idBs</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">wordB</span>)
321
+
322
+ <span class="ruby-identifier">idAs</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">idA</span><span class="ruby-operator">|</span>
323
+ <span class="ruby-identifier">idBs</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">idB</span><span class="ruby-operator">|</span>
324
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">compare_id</span>(<span class="ruby-identifier">idA</span>,<span class="ruby-identifier">idB</span>)
325
+ <span class="ruby-identifier">distance</span> = (<span class="ruby-identifier">alpha</span><span class="ruby-operator">*</span>(<span class="ruby-value">5</span><span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)).<span class="ruby-identifier">round</span>
326
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">distance</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">shortest_Pair</span>.<span class="ruby-identifier">value</span>
327
+ <span class="ruby-identifier">shortest_Pair</span>.<span class="ruby-identifier">value</span> = <span class="ruby-identifier">distance</span>
328
+ <span class="ruby-identifier">shortest_Pair</span>.<span class="ruby-identifier">x_id</span> = <span class="ruby-identifier">idA</span>
329
+ <span class="ruby-identifier">shortest_Pair</span>.<span class="ruby-identifier">y_id</span> = <span class="ruby-identifier">idB</span>
330
+ <span class="ruby-keyword">end</span>
331
+ }
332
+ }
333
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">shortest_Pair</span>
334
+ <span class="ruby-keyword">end</span></pre>
335
+ </div><!-- dist-source -->
336
+
337
+ </div>
338
+
339
+
340
+
341
+
342
+ </div><!-- dist-method -->
343
+
344
+
345
+ <div id="method-c-gen_findstring" class="method-detail ">
346
+
347
+ <div class="method-heading">
348
+ <span class="method-name">gen_findstring</span><span
349
+ class="method-args">(code, start_index)</span>
350
+
351
+ <span class="method-click-advice">click to toggle source</span>
352
+
353
+ </div>
354
+
355
+
356
+ <div class="method-description">
357
+
358
+ <p>Given a word(string) and start_index(int),start_index`s value range is
359
+ [0,4], corresponding Cilin(同义词词林) ID`s different segment: A,a,01,A,01=.
360
+ Returns a string that is used &#39;.&#39; to explace every char from the
361
+ start_index to the string`s end.</p>
362
+
363
+
364
+
365
+
366
+ <div class="method-source-code" id="gen_findstring-source">
367
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 319</span>
368
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">gen_findstring</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">start_index</span>)
369
+ <span class="ruby-identifier">frame</span> = <span class="ruby-identifier">cut_id</span>(<span class="ruby-identifier">code</span>)
370
+ (<span class="ruby-identifier">start_index</span>).<span class="ruby-identifier">upto</span>(<span class="ruby-value">4</span>){<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
371
+ <span class="ruby-value">0</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">frame</span>[<span class="ruby-identifier">i</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-identifier">j</span><span class="ruby-operator">|</span>
372
+ <span class="ruby-identifier">frame</span>[<span class="ruby-identifier">i</span>][<span class="ruby-identifier">j</span>]=<span class="ruby-string">&#39;.&#39;</span>
373
+ }
374
+ }
375
+ <span class="ruby-identifier">combine_id</span>(<span class="ruby-identifier">frame</span>)
376
+ <span class="ruby-keyword">end</span></pre>
377
+ </div><!-- gen_findstring-source -->
378
+
379
+ </div>
380
+
381
+
382
+
383
+
384
+ </div><!-- gen_findstring-method -->
385
+
386
+
387
+ <div id="method-c-get_dist_by_id" class="method-detail ">
388
+
389
+ <div class="method-heading">
390
+ <span class="method-name">get_dist_by_id</span><span
391
+ class="method-args">(idA, idB)</span>
392
+
393
+ <span class="method-click-advice">click to toggle source</span>
394
+
395
+ </div>
396
+
397
+
398
+ <div class="method-description">
399
+
400
+ <p>Given idA(string) and idB(string). Returns semantic distance(int) between
401
+ idA and idB, values in [0,10].</p>
402
+
403
+
404
+
405
+
406
+ <div class="method-source-code" id="get_dist_by_id-source">
407
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 220</span>
408
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_dist_by_id</span>(<span class="ruby-identifier">idA</span>, <span class="ruby-identifier">idB</span>)
409
+ <span class="ruby-identifier">alpha</span>=<span class="ruby-value">10.0</span><span class="ruby-operator">/</span><span class="ruby-value">5</span>
410
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">compare_id</span>(<span class="ruby-identifier">idA</span>,<span class="ruby-identifier">idB</span>)
411
+ (<span class="ruby-identifier">alpha</span><span class="ruby-operator">*</span>(<span class="ruby-value">5</span><span class="ruby-operator">-</span><span class="ruby-identifier">n</span>)).<span class="ruby-identifier">round</span>
412
+ <span class="ruby-keyword">end</span></pre>
413
+ </div><!-- get_dist_by_id-source -->
414
+
415
+ </div>
416
+
417
+
418
+
419
+
420
+ </div><!-- get_dist_by_id-method -->
421
+
422
+
423
+ <div id="method-c-get_equal" class="method-detail ">
424
+
425
+ <div class="method-heading">
426
+ <span class="method-name">get_equal</span><span
427
+ class="method-args">(word)</span>
428
+
429
+ <span class="method-click-advice">click to toggle source</span>
430
+
431
+ </div>
432
+
433
+
434
+ <div class="method-description">
435
+
436
+ <p>Given a word(string). Returns a two dimensional array that contains the
437
+ parameter Word`s equivalent words which divided by different ID that the
438
+ word matchs. If the word has no synonym, nil is returned.</p>
439
+
440
+
441
+
442
+
443
+ <div class="method-source-code" id="get_equal-source">
444
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 174</span>
445
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_equal</span>(<span class="ruby-identifier">word</span>)
446
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_equal?</span>(<span class="ruby-identifier">word</span>)
447
+ <span class="ruby-identifier">equal_words</span>=[]
448
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
449
+ <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
450
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">-1</span>]<span class="ruby-operator">==</span><span class="ruby-node">&quot;#&quot;</span>
451
+ <span class="ruby-identifier">equal_words</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">get_words_by_id</span>(<span class="ruby-identifier">code</span>)
452
+ <span class="ruby-keyword">end</span>
453
+ }
454
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">equal_words</span>
455
+ <span class="ruby-keyword">end</span>
456
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
457
+ <span class="ruby-keyword">end</span></pre>
458
+ </div><!-- get_equal-source -->
459
+
460
+ </div>
461
+
462
+
463
+
464
+
465
+ </div><!-- get_equal-method -->
466
+
467
+
468
+ <div id="method-c-get_id_sum" class="method-detail ">
469
+
470
+ <div class="method-heading">
471
+ <span class="method-name">get_id_sum</span><span
472
+ class="method-args">()</span>
473
+
474
+ <span class="method-click-advice">click to toggle source</span>
475
+
476
+ </div>
477
+
478
+
479
+ <div class="method-description">
480
+
481
+ <p>Returns the total number of different ID in Cilin.</p>
482
+
483
+
484
+
485
+
486
+ <div class="method-source-code" id="get_id_sum-source">
487
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 361</span>
488
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_id_sum</span>
489
+ <span class="ruby-ivar">@IDsIndex</span>.<span class="ruby-identifier">size</span>
490
+ <span class="ruby-keyword">end</span></pre>
491
+ </div><!-- get_id_sum-source -->
492
+
493
+ </div>
494
+
495
+
496
+
497
+
498
+ </div><!-- get_id_sum-method -->
499
+
500
+
501
+ <div id="method-c-get_ids_by_wildcard" class="method-detail ">
502
+
503
+ <div class="method-heading">
504
+ <span class="method-name">get_ids_by_wildcard</span><span
505
+ class="method-args">(wildcard)</span>
506
+
507
+ <span class="method-click-advice">click to toggle source</span>
508
+
509
+ </div>
510
+
511
+
512
+ <div class="method-description">
513
+
514
+ <p>Returns a sorted array containing IDs(string) that match the parameter
515
+ Wildcard(string). The wildcard characters that match any character are ‘*’
516
+ and ‘.’ such as “Aa01A..=”,“Aa**A…” If no match is found, an empty array is
517
+ returned.</p>
518
+
519
+
520
+
521
+
522
+ <div class="method-source-code" id="get_ids_by_wildcard-source">
523
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 80</span>
524
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_ids_by_wildcard</span>(<span class="ruby-identifier">wildcard</span>)
525
+ <span class="ruby-ivar">@IDsTrie</span>.<span class="ruby-identifier">wildcard</span>(<span class="ruby-identifier">wildcard</span>)
526
+ <span class="ruby-keyword">end</span></pre>
527
+ </div><!-- get_ids_by_wildcard-source -->
528
+
529
+ </div>
530
+
531
+
532
+
533
+
534
+ </div><!-- get_ids_by_wildcard-method -->
535
+
536
+
537
+ <div id="method-c-get_ids_by_word" class="method-detail ">
538
+
539
+ <div class="method-heading">
540
+ <span class="method-name">get_ids_by_word</span><span
541
+ class="method-args">(word)</span>
542
+
543
+ <span class="method-click-advice">click to toggle source</span>
544
+
545
+ </div>
546
+
547
+
548
+ <div class="method-description">
549
+
550
+ <p>Returns an array containing IDs(string) that the parameter Word(string)
551
+ matchs.</p>
552
+
553
+ <p>tips: the same word may have a few semantic meanings, so a word can match
554
+ many IDs.</p>
555
+
556
+
557
+
558
+
559
+ <div class="method-source-code" id="get_ids_by_word-source">
560
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 87</span>
561
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
562
+ <span class="ruby-identifier">m</span> = <span class="ruby-ivar">@index</span>[<span class="ruby-identifier">word</span>]
563
+ <span class="ruby-keyword">if</span>(<span class="ruby-identifier">m</span><span class="ruby-operator">==</span><span class="ruby-keyword">nil</span>)
564
+ <span class="ruby-ivar">@logger</span>.<span class="ruby-identifier">error</span>(<span class="ruby-identifier">word</span><span class="ruby-operator">+</span><span class="ruby-string">&quot; is an unlisted word!&quot;</span>)
565
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
566
+ <span class="ruby-keyword">else</span>
567
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">m</span>
568
+ <span class="ruby-keyword">end</span>
569
+ <span class="ruby-keyword">end</span></pre>
570
+ </div><!-- get_ids_by_word-source -->
571
+
572
+ </div>
573
+
574
+
575
+
576
+
577
+ </div><!-- get_ids_by_word-method -->
578
+
579
+
580
+ <div id="method-c-get_index_sum" class="method-detail ">
581
+
582
+ <div class="method-heading">
583
+ <span class="method-name">get_index_sum</span><span
584
+ class="method-args">()</span>
585
+
586
+ <span class="method-click-advice">click to toggle source</span>
587
+
588
+ </div>
589
+
590
+
591
+ <div class="method-description">
592
+
593
+ <p>Returns the total number of different words in Cilin.</p>
594
+
595
+
596
+
597
+
598
+ <div class="method-source-code" id="get_index_sum-source">
599
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 366</span>
600
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_index_sum</span>
601
+ <span class="ruby-ivar">@index</span>.<span class="ruby-identifier">size</span>
602
+ <span class="ruby-keyword">end</span></pre>
603
+ </div><!-- get_index_sum-source -->
604
+
605
+ </div>
606
+
607
+
608
+
609
+
610
+ </div><!-- get_index_sum-method -->
611
+
612
+
613
+ <div id="method-c-get_same" class="method-detail ">
614
+
615
+ <div class="method-heading">
616
+ <span class="method-name">get_same</span><span
617
+ class="method-args">(word)</span>
618
+
619
+ <span class="method-click-advice">click to toggle source</span>
620
+
621
+ </div>
622
+
623
+
624
+ <div class="method-description">
625
+
626
+ <p>Given a word(string). Returns a two dimensional array that contains the
627
+ parameter Word`s synonym which divided by different ID that the word
628
+ matchs. If the word has no synonym, nil is returned.</p>
629
+
630
+
631
+
632
+
633
+ <div class="method-source-code" id="get_same-source">
634
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 156</span>
635
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_same</span>(<span class="ruby-identifier">word</span>)
636
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">has_same?</span>(<span class="ruby-identifier">word</span>)
637
+ <span class="ruby-identifier">same_words</span>=[]
638
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
639
+ <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
640
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">code</span>[<span class="ruby-value">-1</span>]<span class="ruby-operator">==</span><span class="ruby-string">&quot;=&quot;</span>
641
+ <span class="ruby-identifier">same_words</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">get_words_by_id</span>(<span class="ruby-identifier">code</span>)
642
+ <span class="ruby-keyword">end</span>
643
+ }
644
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">same_words</span>
645
+ <span class="ruby-keyword">end</span>
646
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
647
+ <span class="ruby-keyword">end</span></pre>
648
+ </div><!-- get_same-source -->
649
+
650
+ </div>
651
+
652
+
653
+
654
+
655
+ </div><!-- get_same-method -->
656
+
657
+
658
+ <div id="method-c-get_sim_by_id" class="method-detail ">
659
+
660
+ <div class="method-heading">
661
+ <span class="method-name">get_sim_by_id</span><span
662
+ class="method-args">(idA, idB)</span>
663
+
664
+ <span class="method-click-advice">click to toggle source</span>
665
+
666
+ </div>
667
+
668
+
669
+ <div class="method-description">
670
+
671
+ <p>Given idA(string) and idB(string). Returns similarity(float) between idA
672
+ and idB, values in [0,1].</p>
673
+
674
+
675
+
676
+
677
+ <div class="method-source-code" id="get_sim_by_id-source">
678
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 228</span>
679
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_sim_by_id</span>(<span class="ruby-identifier">idA</span>, <span class="ruby-identifier">idB</span>)
680
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">compare_id</span>(<span class="ruby-identifier">idA</span>,<span class="ruby-identifier">idB</span>)
681
+ <span class="ruby-identifier">str</span> = <span class="ruby-identifier">idA</span>.<span class="ruby-identifier">clone</span>
682
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
683
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">0</span>]
684
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span><span class="ruby-operator">==</span><span class="ruby-value">5</span>
685
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;=&quot;</span>
686
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">5</span>]
687
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-node">&quot;#&quot;</span>
688
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">6</span>]
689
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;@&quot;</span>
690
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">5</span>]
691
+ <span class="ruby-keyword">end</span>
692
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">5</span>
693
+ <span class="ruby-identifier">findstring</span>=<span class="ruby-identifier">gen_findstring</span>(<span class="ruby-identifier">str</span>,<span class="ruby-identifier">n</span>)
694
+ <span class="ruby-identifier">node_num</span> = <span class="ruby-ivar">@IDsTrie</span>.<span class="ruby-identifier">wildcard</span>(<span class="ruby-identifier">findstring</span>).<span class="ruby-identifier">size</span>
695
+ <span class="ruby-identifier">k</span> = (<span class="ruby-ivar">@IDsIndex</span>[<span class="ruby-identifier">idA</span>]<span class="ruby-operator">-</span><span class="ruby-ivar">@IDsIndex</span>[<span class="ruby-identifier">idB</span>]).<span class="ruby-identifier">abs</span>
696
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-identifier">n</span>]<span class="ruby-operator">*</span>(<span class="ruby-constant">Math</span>.<span class="ruby-identifier">cos</span>(<span class="ruby-identifier">node_num</span><span class="ruby-operator">*</span><span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span><span class="ruby-operator">/</span><span class="ruby-value">180</span>)).<span class="ruby-identifier">abs</span><span class="ruby-operator">*</span>((<span class="ruby-identifier">node_num</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)<span class="ruby-operator">*</span><span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-identifier">node_num</span>)
697
+ <span class="ruby-keyword">end</span>
698
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">_sim</span>
699
+ <span class="ruby-keyword">end</span></pre>
700
+ </div><!-- get_sim_by_id-source -->
701
+
702
+ </div>
703
+
704
+
705
+
706
+
707
+ </div><!-- get_sim_by_id-method -->
708
+
709
+
710
+ <div id="method-c-get_similar" class="method-detail ">
711
+
712
+ <div class="method-heading">
713
+ <span class="method-name">get_similar</span><span
714
+ class="method-args">(word, level=4)</span>
715
+
716
+ <span class="method-click-advice">click to toggle source</span>
717
+
718
+ </div>
719
+
720
+
721
+ <div class="method-description">
722
+
723
+ <p>Given a word(string) and a level(int),level`s value range is [0,4], 4 is
724
+ default, value of level is more bigger, the similarity between returned
725
+ words and the given word is more less.</p>
726
+
727
+ <p>Returns a two dimensional array that contains the parameter Word`s similar
728
+ words which divided by different ID that the word matchs. If the word has
729
+ no similar, nil is returned.</p>
730
+
731
+ <p>tips: level 0,1,2,3,4 correspond Cilin(同义词词林) ID`s different segment:
732
+ A,a,01,A,01=.</p>
733
+
734
+
735
+
736
+
737
+ <div class="method-source-code" id="get_similar-source">
738
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 197</span>
739
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_similar</span>(<span class="ruby-identifier">word</span>, <span class="ruby-identifier">level</span>=<span class="ruby-value">4</span>)
740
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
741
+ <span class="ruby-identifier">similar</span>=[]
742
+ <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">code</span><span class="ruby-operator">|</span>
743
+ <span class="ruby-identifier">mini_similar</span>=[]
744
+ <span class="ruby-identifier">findstring</span> = <span class="ruby-identifier">gen_findstring</span>(<span class="ruby-identifier">code</span>, <span class="ruby-identifier">level</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)
745
+ <span class="ruby-identifier">similar_IDs</span>=<span class="ruby-ivar">@IDsTrie</span>.<span class="ruby-identifier">wildcard</span>(<span class="ruby-identifier">findstring</span>)
746
+ <span class="ruby-identifier">similar_IDs</span>.<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
747
+ <span class="ruby-identifier">get_words_by_id</span>(<span class="ruby-identifier">item</span>).<span class="ruby-identifier">each</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">term</span><span class="ruby-operator">|</span>
748
+ <span class="ruby-identifier">mini_similar</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">term</span>
749
+ }
750
+ }
751
+ <span class="ruby-identifier">similar</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">mini_similar</span>
752
+ }
753
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">similar</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
754
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">similar</span>
755
+ <span class="ruby-keyword">else</span>
756
+ <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span>
757
+ <span class="ruby-keyword">end</span>
758
+ <span class="ruby-keyword">end</span></pre>
759
+ </div><!-- get_similar-source -->
760
+
761
+ </div>
762
+
763
+
764
+
765
+
766
+ </div><!-- get_similar-method -->
767
+
768
+
769
+ <div id="method-c-get_words_by_id" class="method-detail ">
770
+
771
+ <div class="method-heading">
772
+ <span class="method-name">get_words_by_id</span><span
773
+ class="method-args">(id)</span>
774
+
775
+ <span class="method-click-advice">click to toggle source</span>
776
+
777
+ </div>
778
+
779
+
780
+ <div class="method-description">
781
+
782
+ <p>Given id(string) such as:“Aa01A01=” “Aa01A03#” Returns an array containing
783
+ words(string) that match this id If no match is found, nil is returned.</p>
784
+
785
+
786
+
787
+
788
+ <div class="method-source-code" id="get_words_by_id-source">
789
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 73</span>
790
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">get_words_by_id</span>(<span class="ruby-identifier">id</span>)
791
+ <span class="ruby-ivar">@IDsTrie</span>[<span class="ruby-identifier">id</span>]
792
+ <span class="ruby-keyword">end</span></pre>
793
+ </div><!-- get_words_by_id-source -->
794
+
795
+ </div>
796
+
797
+
798
+
799
+
800
+ </div><!-- get_words_by_id-method -->
801
+
802
+
803
+ <div id="method-c-has_equal-3F" class="method-detail ">
804
+
805
+ <div class="method-heading">
806
+ <span class="method-name">has_equal?</span><span
807
+ class="method-args">(word)</span>
808
+
809
+ <span class="method-click-advice">click to toggle source</span>
810
+
811
+ </div>
812
+
813
+
814
+ <div class="method-description">
815
+
816
+ <p>Given a word(string). Test to see if the parameter Word has any equivalent
817
+ word. Returns true or false.</p>
818
+
819
+
820
+
821
+
822
+ <div class="method-source-code" id="has_equal-3F-source">
823
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 118</span>
824
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">has_equal?</span>(<span class="ruby-identifier">word</span>)
825
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
826
+ <span class="ruby-identifier">i</span>=<span class="ruby-value">0</span>
827
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
828
+ <span class="ruby-keyword">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">flag</span><span class="ruby-operator">==</span><span class="ruby-keyword">false</span> <span class="ruby-keyword">do</span>
829
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">ids</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">-1</span>]<span class="ruby-operator">==</span><span class="ruby-node">&quot;#&quot;</span>
830
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">true</span>
831
+ <span class="ruby-keyword">else</span>
832
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
833
+ <span class="ruby-keyword">end</span>
834
+ <span class="ruby-identifier">i</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
835
+ <span class="ruby-keyword">end</span>
836
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">flag</span>
837
+ <span class="ruby-keyword">end</span></pre>
838
+ </div><!-- has_equal-3F-source -->
839
+
840
+ </div>
841
+
842
+
843
+
844
+
845
+ </div><!-- has_equal-3F-method -->
846
+
847
+
848
+ <div id="method-c-has_same-3F" class="method-detail ">
849
+
850
+ <div class="method-heading">
851
+ <span class="method-name">has_same?</span><span
852
+ class="method-args">(word)</span>
853
+
854
+ <span class="method-click-advice">click to toggle source</span>
855
+
856
+ </div>
857
+
858
+
859
+ <div class="method-description">
860
+
861
+ <p>Given a word(string). Test to see if the parameter Word has any synonym.
862
+ Returns true or false.</p>
863
+
864
+
865
+
866
+
867
+ <div class="method-source-code" id="has_same-3F-source">
868
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 100</span>
869
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">has_same?</span>(<span class="ruby-identifier">word</span>)
870
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
871
+ <span class="ruby-identifier">i</span>=<span class="ruby-value">0</span>
872
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
873
+ <span class="ruby-keyword">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">flag</span><span class="ruby-operator">==</span><span class="ruby-keyword">false</span> <span class="ruby-keyword">do</span>
874
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">ids</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">-1</span>]<span class="ruby-operator">==</span><span class="ruby-string">&quot;=&quot;</span>
875
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">true</span>
876
+ <span class="ruby-keyword">else</span>
877
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
878
+ <span class="ruby-keyword">end</span>
879
+ <span class="ruby-identifier">i</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
880
+ <span class="ruby-keyword">end</span>
881
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">flag</span>
882
+ <span class="ruby-keyword">end</span></pre>
883
+ </div><!-- has_same-3F-source -->
884
+
885
+ </div>
886
+
887
+
888
+
889
+
890
+ </div><!-- has_same-3F-method -->
891
+
892
+
893
+ <div id="method-c-has_single-3F" class="method-detail ">
894
+
895
+ <div class="method-heading">
896
+ <span class="method-name">has_single?</span><span
897
+ class="method-args">(word)</span>
898
+
899
+ <span class="method-click-advice">click to toggle source</span>
900
+
901
+ </div>
902
+
903
+
904
+ <div class="method-description">
905
+
906
+ <p>Given a word(string). Test to see if the parameter Word has any ID whose
907
+ corresponding words list just has only one element. Returns true or
908
+ false.</p>
909
+
910
+
911
+
912
+
913
+ <div class="method-source-code" id="has_single-3F-source">
914
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 137</span>
915
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">has_single?</span>(<span class="ruby-identifier">word</span>)
916
+ <span class="ruby-identifier">ids</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">word</span>)
917
+ <span class="ruby-identifier">i</span>=<span class="ruby-value">0</span>
918
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
919
+ <span class="ruby-keyword">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">ids</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">flag</span><span class="ruby-operator">==</span><span class="ruby-keyword">false</span> <span class="ruby-keyword">do</span>
920
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">ids</span>[<span class="ruby-identifier">i</span>][<span class="ruby-value">-1</span>]<span class="ruby-operator">==</span><span class="ruby-string">&quot;@&quot;</span>
921
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">true</span>
922
+ <span class="ruby-keyword">else</span>
923
+ <span class="ruby-identifier">flag</span>=<span class="ruby-keyword">false</span>
924
+ <span class="ruby-keyword">end</span>
925
+ <span class="ruby-identifier">i</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
926
+ <span class="ruby-keyword">end</span>
927
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">flag</span>
928
+ <span class="ruby-keyword">end</span></pre>
929
+ </div><!-- has_single-3F-source -->
930
+
931
+ </div>
932
+
933
+
934
+
935
+
936
+ </div><!-- has_single-3F-method -->
937
+
938
+
939
+ <div id="method-c-sim" class="method-detail ">
940
+
941
+ <div class="method-heading">
942
+ <span class="method-name">sim</span><span
943
+ class="method-args">(wordA, wordB)</span>
944
+
945
+ <span class="method-click-advice">click to toggle source</span>
946
+
947
+ </div>
948
+
949
+
950
+ <div class="method-description">
951
+
952
+ <p>Given wordA(string) and wordB(string). Returns a Struct Result_t which
953
+ contains the most similar Pairs wordA`s ID and wordB`s ID, and
954
+ similarity(float) between idA and idB.</p>
955
+
956
+
957
+
958
+
959
+ <div class="method-source-code" id="sim-source">
960
+ <pre><span class="ruby-comment"># File lib/tyccl.rb, line 276</span>
961
+ <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">sim</span>(<span class="ruby-identifier">wordA</span>, <span class="ruby-identifier">wordB</span>)
962
+ <span class="ruby-identifier">factor</span>=[<span class="ruby-value">0.02</span>,<span class="ruby-value">0.65</span>,<span class="ruby-value">0.8</span>,<span class="ruby-value">0.9</span>,<span class="ruby-value">0.96</span>,<span class="ruby-value">1</span>,<span class="ruby-value">0.5</span>]<span class="ruby-comment">#0,1,2,3,4,5各层参数</span>
963
+ <span class="ruby-identifier">longest_Pair</span> = <span class="ruby-constant">Result_t</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">-1</span>,<span class="ruby-string">&quot;&quot;</span>,<span class="ruby-string">&quot;&quot;</span>)
964
+ <span class="ruby-identifier">idAs</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">wordA</span>)
965
+ <span class="ruby-identifier">idBs</span> = <span class="ruby-identifier">get_ids_by_word</span>(<span class="ruby-identifier">wordB</span>)
966
+
967
+ <span class="ruby-identifier">idAs</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">idA</span><span class="ruby-operator">|</span>
968
+ <span class="ruby-identifier">idBs</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">idB</span><span class="ruby-operator">|</span>
969
+ <span class="ruby-identifier">n</span> = <span class="ruby-identifier">compare_id</span>(<span class="ruby-identifier">idA</span>,<span class="ruby-identifier">idB</span>)
970
+ <span class="ruby-identifier">str</span> = <span class="ruby-identifier">idA</span>.<span class="ruby-identifier">clone</span>
971
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">n</span><span class="ruby-operator">==</span><span class="ruby-value">0</span>
972
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">0</span>]
973
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span><span class="ruby-operator">==</span><span class="ruby-value">5</span>
974
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;=&quot;</span>
975
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">5</span>]
976
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-node">&quot;#&quot;</span>
977
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">6</span>]
978
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">idA</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-string">&quot;@&quot;</span>
979
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-value">5</span>]
980
+ <span class="ruby-keyword">end</span>
981
+ <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">n</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">5</span>
982
+ <span class="ruby-identifier">findstring</span>=<span class="ruby-identifier">gen_findstring</span>(<span class="ruby-identifier">str</span>,<span class="ruby-identifier">n</span>)
983
+ <span class="ruby-identifier">node_num</span> = <span class="ruby-ivar">@IDsTrie</span>.<span class="ruby-identifier">wildcard</span>(<span class="ruby-identifier">findstring</span>).<span class="ruby-identifier">size</span>
984
+ <span class="ruby-identifier">k</span> = (<span class="ruby-ivar">@IDsIndex</span>[<span class="ruby-identifier">idA</span>]<span class="ruby-operator">-</span><span class="ruby-ivar">@IDsIndex</span>[<span class="ruby-identifier">idB</span>]).<span class="ruby-identifier">abs</span>
985
+ <span class="ruby-identifier">_sim</span> = <span class="ruby-identifier">factor</span>[<span class="ruby-identifier">n</span>]<span class="ruby-operator">*</span>(<span class="ruby-constant">Math</span>.<span class="ruby-identifier">cos</span>(<span class="ruby-identifier">node_num</span><span class="ruby-operator">*</span><span class="ruby-constant">Math</span><span class="ruby-operator">::</span><span class="ruby-constant">PI</span><span class="ruby-operator">/</span><span class="ruby-value">180</span>)).<span class="ruby-identifier">abs</span><span class="ruby-operator">*</span>((<span class="ruby-identifier">node_num</span><span class="ruby-operator">-</span><span class="ruby-identifier">k</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>)<span class="ruby-operator">*</span><span class="ruby-value">1.0</span><span class="ruby-operator">/</span><span class="ruby-identifier">node_num</span>)
986
+ <span class="ruby-keyword">end</span>
987
+
988
+ <span class="ruby-keyword">if</span> <span class="ruby-identifier">_sim</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">value</span>
989
+ <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">value</span> = <span class="ruby-identifier">_sim</span>
990
+ <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">x_id</span> = <span class="ruby-identifier">idA</span>
991
+ <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">y_id</span> = <span class="ruby-identifier">idB</span>
992
+ <span class="ruby-keyword">end</span>
993
+ }
994
+ }
995
+ <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">value</span> = (<span class="ruby-string">&quot;%1.5f&quot;</span> <span class="ruby-operator">%</span> <span class="ruby-identifier">longest_Pair</span>.<span class="ruby-identifier">value</span>).<span class="ruby-identifier">to_f</span>
996
+ <span class="ruby-keyword">return</span> <span class="ruby-identifier">longest_Pair</span>
997
+ <span class="ruby-keyword">end</span></pre>
998
+ </div><!-- sim-source -->
999
+
1000
+ </div>
1001
+
1002
+
1003
+
1004
+
1005
+ </div><!-- sim-method -->
1006
+
1007
+
1008
+ </section><!-- public-class-method-details -->
1009
+
1010
+ </section><!-- 5Buntitled-5D -->
1011
+
1012
+ </div><!-- documentation -->
1013
+
1014
+
1015
+ <footer id="validator-badges">
1016
+ <p><a href="http://validator.w3.org/check/referer">[Validate]</a>
1017
+ <p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
1018
+ <p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
1019
+ </footer>
1020
+