rseg 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dict/dict.hash +0 -0
- data/lib/builder/dict.rb +0 -1
- data/lib/engines/dict.rb +13 -6
- data/lib/rseg.rb +1 -6
- metadata +21 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.4
|
data/dict/dict.hash
CHANGED
Binary file
|
data/lib/builder/dict.rb
CHANGED
data/lib/engines/dict.rb
CHANGED
@@ -1,8 +1,19 @@
|
|
1
1
|
class Dict < Engine
|
2
|
-
@@root
|
2
|
+
@@root = nil
|
3
|
+
@@dict_path = File.join(File.dirname(__FILE__), '../../dict/dict.hash')
|
4
|
+
|
5
|
+
class << self
|
6
|
+
def dict_path=(path)
|
7
|
+
@@dict_path = path
|
8
|
+
end
|
9
|
+
|
10
|
+
def dict_path
|
11
|
+
@@dict_path
|
12
|
+
end
|
13
|
+
end
|
3
14
|
|
4
15
|
def initialize
|
5
|
-
@@root ||= load_dict(dict_path)
|
16
|
+
@@root ||= load_dict(@@dict_path)
|
6
17
|
@word = ''
|
7
18
|
@node = @@root
|
8
19
|
super
|
@@ -35,8 +46,4 @@ class Dict < Engine
|
|
35
46
|
def load_dict(path)
|
36
47
|
File.open(path, "rb") {|io| Marshal.load(io)}
|
37
48
|
end
|
38
|
-
|
39
|
-
def dict_path
|
40
|
-
File.join(File.dirname(__FILE__), '../../dict/dict.hash')
|
41
|
-
end
|
42
49
|
end
|
data/lib/rseg.rb
CHANGED
@@ -21,12 +21,7 @@ class Rseg
|
|
21
21
|
Rseg.instance.input = input
|
22
22
|
Rseg.instance.segment
|
23
23
|
end
|
24
|
-
|
25
|
-
def load
|
26
|
-
Rseg.instance
|
27
|
-
nil
|
28
|
-
end
|
29
|
-
|
24
|
+
|
30
25
|
def remote_segment(input)
|
31
26
|
begin
|
32
27
|
response = Net::HTTP.post_form(URI.parse('http://127.0.0.1:4100/seg'), :input => input)
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rseg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
9
|
+
- 4
|
10
|
+
version: 0.1.4
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Yuanyi Zhang
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-11-28 00:00:00 +08:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: haml
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 3
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
version: "0"
|
@@ -33,9 +36,11 @@ dependencies:
|
|
33
36
|
name: sinatra
|
34
37
|
prerelease: false
|
35
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
36
40
|
requirements:
|
37
41
|
- - ">="
|
38
42
|
- !ruby/object:Gem::Version
|
43
|
+
hash: 3
|
39
44
|
segments:
|
40
45
|
- 0
|
41
46
|
version: "0"
|
@@ -74,6 +79,14 @@ files:
|
|
74
79
|
- public/screen.css
|
75
80
|
- views/index.haml
|
76
81
|
- views/layout.haml
|
82
|
+
- test/test_auto.rb
|
83
|
+
- test/test_bench.rb
|
84
|
+
- test/test_ent.rb
|
85
|
+
- test/test_finance.rb
|
86
|
+
- test/test_news.rb
|
87
|
+
- test/test_sport.rb
|
88
|
+
- test/test_tech.rb
|
89
|
+
- test/test_web.rb
|
77
90
|
has_rdoc: true
|
78
91
|
homepage: http://github.com/yzhang/rseg
|
79
92
|
licenses: []
|
@@ -84,23 +97,27 @@ rdoc_options:
|
|
84
97
|
require_paths:
|
85
98
|
- lib
|
86
99
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
87
101
|
requirements:
|
88
102
|
- - ">="
|
89
103
|
- !ruby/object:Gem::Version
|
104
|
+
hash: 3
|
90
105
|
segments:
|
91
106
|
- 0
|
92
107
|
version: "0"
|
93
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
94
110
|
requirements:
|
95
111
|
- - ">="
|
96
112
|
- !ruby/object:Gem::Version
|
113
|
+
hash: 3
|
97
114
|
segments:
|
98
115
|
- 0
|
99
116
|
version: "0"
|
100
117
|
requirements: []
|
101
118
|
|
102
119
|
rubyforge_project:
|
103
|
-
rubygems_version: 1.3.
|
120
|
+
rubygems_version: 1.3.7
|
104
121
|
signing_key:
|
105
122
|
specification_version: 3
|
106
123
|
summary: "A Chinese Word Segmentation(\xE4\xB8\xAD\xE6\x96\x87\xE5\x88\x86\xE8\xAF\x8D) routine in pure Ruby"
|