tyccl 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/Gemfile +6 -0
- data/LICENSE +20 -0
- data/README.md +67 -0
- data/Rakefile +1 -0
- data/lib/Inverted.yaml +77458 -0
- data/lib/cilin.txt +17817 -0
- data/lib/tyccl/version.rb +3 -0
- data/lib/tyccl.rb +374 -0
- data/test/test_tyccl.rb +151 -0
- data/tyccl.gemspec +23 -0
- metadata +85 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7b0a2da23656be201535e7b4325397f4e0c26184
|
4
|
+
data.tar.gz: efdc23f2ecc1997890a53058cf5b3984caa5d3be
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 87bc9f7df2707aec0d0bb31e7b09a3bc24a62ca57ee6eefde09046eb4fa7f5b8ff7b681e34808c1ace638accfda393161b1b0bb13a53d70f55363d6cbc27204f
|
7
|
+
data.tar.gz: 92a644e0f620b3c52e010d529196ec6dd06f59c20898464ec3fa48897f310837ddf3247a8b70647af9da1193139dd66143ef4b6971adb4ec3c228c87a2e2ab52
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 吴健
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# Tyccl
|
2
|
+
|
3
|
+
tyccl(同义词词林 哈工大扩展版) is a ruby gem that provides friendly functions to analyse similarity between Chinese Words.
|
4
|
+
|
5
|
+
all of Tyccl`s source files using charset: UTF-8
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'tyccl'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install tyccl
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
simple example:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
|
27
|
+
require 'tyccl'
|
28
|
+
tyc = Tyccl.instance # singleton class
|
29
|
+
|
30
|
+
# Given wordA(string) and wordB(string).
|
31
|
+
# Returns a Struct Result_t which contains idA, idB, and shortest semantic distance(int) between wordA and wordB.
|
32
|
+
|
33
|
+
result = tyc.dist("西红柿","黄瓜")
|
34
|
+
puts result.value
|
35
|
+
puts result.x_id
|
36
|
+
puts result.y_id
|
37
|
+
|
38
|
+
# Given wordA(string) and wordB(string).
|
39
|
+
# 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.
|
40
|
+
result = tyc.sim("西红柿","黄瓜")
|
41
|
+
puts result.value
|
42
|
+
puts result.x_id
|
43
|
+
puts result.y_id
|
44
|
+
|
45
|
+
# 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.
|
46
|
+
# Returns a two dimensional array that contains the parameter Word`s similar words which divided by different ID that the word matchs.
|
47
|
+
# If the word has no similar, nil is returned.
|
48
|
+
|
49
|
+
m = tyc.get_similar("人")
|
50
|
+
puts m
|
51
|
+
#[ ["人", "士", "人物", "人士", "人氏", "人选"],
|
52
|
+
# ["成年人", "壮年人", "大人", "人", "丁", "壮丁", "佬", "中年人"],
|
53
|
+
# ["身体", "人"],
|
54
|
+
# ["人格", "人品", "人头", "人", "品质", "质地", "格调", "灵魂", "为人"],
|
55
|
+
# ["人数", "人头", "人口", "人", "口", "丁", "家口", "食指", "总人口"] ]
|
56
|
+
|
57
|
+
```
|
58
|
+
see more methods in tyccl/doc/index.html and more example in [test](tyccl/test/test_nlpir.rb)
|
59
|
+
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
1. Fork it ( http://github.com/<my-github-username>/tyccl/fork )
|
63
|
+
2. Create your feature branch (`git checkout -b fork-new`)
|
64
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
65
|
+
4. Push to the branch (`git push origin fork-new`)
|
66
|
+
5. Create new Pull Request
|
67
|
+
>>>>>>> master
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|