/
index.html
166 lines (116 loc) · 7.82 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>RDoc Documentation</title>
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
</script>
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
<body>
<nav id="metadata">
<nav id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<h3 class="section-header">
<input type="text" name="search" placeholder="Search" id="search-field"
title="Type to search, Up and Down to navigate, Enter to load">
</h3>
</form>
<ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="project-metadata">
<nav id="fileindex-section" class="section project-section">
<h3 class="section-header">Pages</h3>
<ul>
<li class="file"><a href="./README_md.html">README</a>
</ul>
</nav>
<nav id="classindex-section" class="section project-section">
<h3 class="section-header">Class and Module Index</h3>
<ul class="link-list">
<li><a href="./Object.html">Object</a>
<li><a href="./Tyccl.html">Tyccl</a>
<li><a href="./Tyccl/Containers.html">Tyccl::Containers</a>
<li><a href="./Tyccl/Logger.html">Tyccl::Logger</a>
<li><a href="./Tyccl/YAML.html">Tyccl::YAML</a>
</ul>
</nav>
</div>
</nav>
<div id="documentation" class="description">
<h1 id="label-Tyccl"><a href="Tyccl.html">Tyccl</a><span><a href="#label-Tyccl">¶</a> <a href="#documentation">↑</a></span></h1>
<p>tyccl(同义词词林 哈工大扩展版) is a ruby gem that provides friendly functions to
analyse similarity between Chinese Words.</p>
<p>all of Tyccl`s source files using charset: UTF-8</p>
<h2 id="label-Installation">Installation<span><a href="#label-Installation">¶</a> <a href="#documentation">↑</a></span></h2>
<p>Add this line to your application's Gemfile:</p>
<pre>gem 'tyccl'</pre>
<p>And then execute:</p>
<pre>$ bundle</pre>
<p>Or install it yourself as:</p>
<pre>$ gem install tyccl</pre>
<h2 id="label-Usage">Usage<span><a href="#label-Usage">¶</a> <a href="#documentation">↑</a></span></h2>
<p>simple example:</p>
<pre class="ruby">
<span class="ruby-comment"># Result_t = Struct.new(:value,:x_id,:y_id)</span>
<span class="ruby-comment"># this struct is used to return analysing result</span>
<span class="ruby-comment"># * field 'value' store the analysing value</span>
<span class="ruby-comment"># * field 'x_id' 'y_id' store the ID of word X and Y </span>
<span class="ruby-identifier">require</span> <span class="ruby-string">'tyccl'</span>
<span class="ruby-comment"># Given wordA(string) and wordB(string). </span>
<span class="ruby-comment"># Returns a Struct Result_t which contains idA, idB, and shortest semantic distance(int) between wordA and wordB. </span>
<span class="ruby-identifier">result</span> = <span class="ruby-constant">Tyccl</span>.<span class="ruby-identifier">dist</span>(<span class="ruby-string">"西红柿"</span>,<span class="ruby-string">"黄瓜"</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">value</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">x_id</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">y_id</span>
<span class="ruby-comment"># Given wordA(string) and wordB(string).</span>
<span class="ruby-comment"># Returns a Struct Result_t which contains the most similar Pairs wordA`s ID and wordB`s ID, and similarity(float) between idA and idB.</span>
<span class="ruby-identifier">result</span> = <span class="ruby-constant">Tyccl</span>.<span class="ruby-identifier">sim</span>(<span class="ruby-string">"西红柿"</span>,<span class="ruby-string">"黄瓜"</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">value</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">x_id</span>
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">y_id</span>
<span class="ruby-comment"># Given a word(string) and a level(int),level`s value range is [0,4],4 is default, value of level is more bigger, the similarity between returned words and the given word is more less. </span>
<span class="ruby-comment"># Returns a two dimensional array that contains the parameter Word`s similar words which divided by different ID that the word matchs.</span>
<span class="ruby-comment"># If the word has no similar, nil is returned.</span>
<span class="ruby-identifier">m</span> = <span class="ruby-constant">Tyccl</span>.<span class="ruby-identifier">get_similar</span>(<span class="ruby-string">"人"</span>)
<span class="ruby-identifier">puts</span> <span class="ruby-identifier">m</span>
<span class="ruby-comment">#[ ["人", "士", "人物", "人士", "人氏", "人选"],</span>
<span class="ruby-comment"># ["成年人", "壮年人", "大人", "人", "丁", "壮丁", "佬", "中年人"],</span>
<span class="ruby-comment"># ["身体", "人"],</span>
<span class="ruby-comment"># ["人格", "人品", "人头", "人", "品质", "质地", "格调", "灵魂", "为人"],</span>
<span class="ruby-comment"># ["人数", "人头", "人口", "人", "口", "丁", "家口", "食指", "总人口"] ]</span>
</pre>
<p>download and see more methods in <a
href="https://github.com/JoeWoo/tyccl/blob/master/doc/index.html">api
doc</a> and more examples in <a
href="https://github.com/JoeWoo/tyccl/blob/master/test/test_tyccl.rb">test</a>.</p>
<h2 id="label-Contributing">Contributing<span><a href="#label-Contributing">¶</a> <a href="#documentation">↑</a></span></h2>
<p>1. Fork it ( <a
href="http://github.com/JoeWoo/tyccl/fork">github.com/JoeWoo/tyccl/fork</a>
)
2. Create your feature branch (<code>git checkout -b fork-new</code>)
3.
Commit your changes (<code>git commit -am 'Add some
feature'</code>)
4. Push to the branch (<code>git push origin
fork-new</code>)
5. Create new Pull Request</p>
</div>
<footer id="validator-badges">
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 4.0.0.
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>