sekka 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/Rakefile +28 -26
- data/VERSION.yml +1 -2
- data/bin/sekka-jisyo +10 -7
- data/bin/sekka-server +30 -1
- data/emacs/sekka.el +73 -46
- data/lib/sekka/jisyo-db.nnd +1 -0
- data/lib/sekka/kvs.rb +16 -13
- data/lib/sekka/sekkaversion.rb +1 -1
- data/lib/sekkaserver.rb +7 -2
- data/test/henkan-bench.nnd +1 -1
- data/test/henkan-main.nnd +24 -21
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MTZlYTYwNTE2MzU4YTRjNjdlY2NlYzJmZWU5MmU3NmE4ZWViZmE2Mjg3Zjc5
|
10
|
-
Yzc3MDcwZGYwZGUxNTE5YjZhMDZkMTlhMDJhNmQ4MGViZmJhYzFhYjgwNGQ1
|
11
|
-
ZGE4NzFjNzMyOThlYjZhMzkyNmFmMjk5ZTVjODg3NjE1YTY3YWY=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTgzMTY4MWM2NzNmYWI3MjY4ZThjZjliNjBmYjgxZGFmNTcyZmVmN2NlNjNi
|
14
|
-
ZTcyMDM5ZjkyOTNiNmFjNDI3Mzg3MzJmOGQ5ZTg5ZmFiZjg2Mjk0YzZiMDU1
|
15
|
-
NDRlOTdhMWMzN2U5NTY3YTQzMmEwN2RhMWJmZDEzNWQ4OTQwNGY=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 63653bf0ea892633864db0ac60ca1e1d08023440
|
4
|
+
data.tar.gz: 18a98c08d61e515eaee30cc6ee1b499ee68a51c3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3a6b9dd120e4279405218ea7423af020f9a7baee09bd5aaf2a766b3f171c50eded38c5c64ccb9377df99a0cb4815f8bedf02d0ec96f73e27748a3e6cce6f209c
|
7
|
+
data.tar.gz: 5b5d025e73f0d48a1a877d15068ade452e76984cf8328fff13b391b4f723822699e4a623fdf281cb54772db64a1b9abe46c54949514c23b31bafcffab8502381
|
data/Rakefile
CHANGED
@@ -12,17 +12,18 @@
|
|
12
12
|
#
|
13
13
|
# Enviroment Variables:
|
14
14
|
# Please select from
|
15
|
-
# DB=
|
15
|
+
# DB=gdbm
|
16
16
|
# DB=tokyocabinet
|
17
17
|
# DB=redis
|
18
18
|
# DB= (default)
|
19
|
-
# DB=all
|
19
|
+
# DB=all gdbm/tokyocabinet/redis
|
20
20
|
#
|
21
21
|
|
22
22
|
require 'rake'
|
23
23
|
|
24
24
|
# generate `normal' and `azik' dictionary
|
25
|
-
generateTypes = [ "N", "A" ]
|
25
|
+
# (generateTypes = [ "N", "A" ])
|
26
|
+
generateTypes = [ "N" ]
|
26
27
|
|
27
28
|
begin
|
28
29
|
require 'jeweler2'
|
@@ -108,8 +109,8 @@ task :compile do
|
|
108
109
|
end
|
109
110
|
|
110
111
|
task :test do
|
111
|
-
sh "ruby -I ./lib ./bin/sekka-path >
|
112
|
-
path1 = open( "
|
112
|
+
sh "ruby -I ./lib ./bin/sekka-path > ./path1.tmp"
|
113
|
+
path1 = open( "./path1.tmp" ) {|f|
|
113
114
|
f.readline.chomp
|
114
115
|
}
|
115
116
|
path2 = File.dirname( __FILE__ )
|
@@ -118,7 +119,9 @@ task :test do
|
|
118
119
|
exit 1
|
119
120
|
end
|
120
121
|
|
121
|
-
|
122
|
+
["test.record", "test.tch", "test.db" ].each {|name|
|
123
|
+
File.unlink( name ) if File.exist?( name )
|
124
|
+
}
|
122
125
|
files = []
|
123
126
|
files << "./test/memcache.nnd"
|
124
127
|
files << "./test/util.nnd"
|
@@ -130,8 +133,8 @@ task :test do
|
|
130
133
|
files << "./test/google-ime.nnd"
|
131
134
|
STDERR.printf( "Info: env DB=%s\n", ENV['DB'] )
|
132
135
|
case ENV['DB']
|
133
|
-
when '
|
134
|
-
files << "./test/henkan-main.nnd
|
136
|
+
when 'gdbm'
|
137
|
+
files << "./test/henkan-main.nnd gdbm"
|
135
138
|
when 'tokyocabinet'
|
136
139
|
files << "./test/henkan-main.nnd tokyocabinet"
|
137
140
|
when 'redis'
|
@@ -140,7 +143,7 @@ task :test do
|
|
140
143
|
when 'pure'
|
141
144
|
files << "./test/henkan-main.nnd pure"
|
142
145
|
when 'all'
|
143
|
-
files << "./test/henkan-main.nnd
|
146
|
+
files << "./test/henkan-main.nnd gdbm"
|
144
147
|
files << "./test/henkan-main.nnd tokyocabinet"
|
145
148
|
files << "./test/henkan-main.nnd redis"
|
146
149
|
files << "./test/henkan-main.nnd pure"
|
@@ -149,8 +152,7 @@ task :test do
|
|
149
152
|
files << "./test/henkan-main.nnd pure"
|
150
153
|
end
|
151
154
|
files.each {|filename|
|
152
|
-
|
153
|
-
sh sprintf( "ruby -I ./lib %s %s", nendopath, filename )
|
155
|
+
sh sprintf( "ruby -I ./lib -S nendo %s", filename )
|
154
156
|
}
|
155
157
|
sh "cat test.record"
|
156
158
|
end
|
@@ -166,46 +168,46 @@ task :alljisyoL => [ :jisyoL, :loadL, :dumpL ]
|
|
166
168
|
|
167
169
|
task :jisyoS do
|
168
170
|
generateTypes.each {|x|
|
169
|
-
sh "
|
170
|
-
sh "
|
171
|
-
sh "
|
172
|
-
sh "
|
171
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.L.201008 > ./data/SEKKA-JISYO.SMALL.#{x}"
|
172
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.L.hira-kata >> ./data/SEKKA-JISYO.SMALL.#{x}"
|
173
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.hiragana-phrase >> ./data/SEKKA-JISYO.SMALL.#{x}"
|
174
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.hiragana-phrase2 >> ./data/SEKKA-JISYO.SMALL.#{x}"
|
173
175
|
}
|
174
176
|
end
|
175
177
|
|
176
178
|
task :jisyoL do
|
177
179
|
generateTypes.each {|x|
|
178
|
-
sh "
|
179
|
-
sh "
|
180
|
-
sh "
|
181
|
-
sh "
|
182
|
-
sh "
|
183
|
-
sh "
|
184
|
-
sh "
|
180
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.L.201008 > ./data/SEKKA-JISYO.LARGE.#{x}"
|
181
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.L.hira-kata >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
182
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.fullname >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
183
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.jinmei >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
184
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.station >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
185
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.hiragana-phrase >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
186
|
+
sh "ruby ./bin/sekka-jisyo convert#{x} ./data/SKK-JISYO.hiragana-phrase2 >> ./data/SEKKA-JISYO.LARGE.#{x}"
|
185
187
|
}
|
186
188
|
end
|
187
189
|
|
188
190
|
task :loadS do
|
189
191
|
generateTypes.each {|x|
|
190
|
-
sh "
|
192
|
+
sh "ruby ./bin/sekka-jisyo load ./data/SEKKA-JISYO.SMALL.#{x} ./data/SEKKA-JISYO.SMALL.#{x}.tch"
|
191
193
|
}
|
192
194
|
end
|
193
195
|
|
194
196
|
task :loadL do
|
195
197
|
generateTypes.each {|x|
|
196
|
-
sh "
|
198
|
+
sh "ruby ./bin/sekka-jisyo load ./data/SEKKA-JISYO.LARGE.#{x} ./data/SEKKA-JISYO.LARGE.#{x}.tch"
|
197
199
|
}
|
198
200
|
end
|
199
201
|
|
200
202
|
task :dumpS do
|
201
203
|
generateTypes.each {|x|
|
202
|
-
sh "
|
204
|
+
sh "ruby ./bin/sekka-jisyo dump ./data/SEKKA-JISYO.SMALL.#{x}.tch > ./data/SEKKA-JISYO.SMALL.#{x}.tsv"
|
203
205
|
}
|
204
206
|
end
|
205
207
|
|
206
208
|
task :dumpL do
|
207
209
|
generateTypes.each {|x|
|
208
|
-
sh "
|
210
|
+
sh "ruby ./bin/sekka-jisyo dump ./data/SEKKA-JISYO.LARGE.#{x}.tch > ./data/SEKKA-JISYO.LARGE.#{x}.tsv"
|
209
211
|
}
|
210
212
|
end
|
211
213
|
|
data/VERSION.yml
CHANGED
data/bin/sekka-jisyo
CHANGED
@@ -48,8 +48,9 @@ core.evalStr( <<";;END-OF-SCRIPT" )
|
|
48
48
|
(let1 lines (with-open
|
49
49
|
filename
|
50
50
|
(lambda (f)
|
51
|
-
(convert-skk-jisyo-f f))
|
52
|
-
|
51
|
+
(convert-skk-jisyo-f f))
|
52
|
+
"r:UTF-8")
|
53
|
+
(for-each print lines)))
|
53
54
|
|
54
55
|
|
55
56
|
(define (load-sekka-jisyo sekka-file target)
|
@@ -59,7 +60,8 @@ core.evalStr( <<";;END-OF-SCRIPT" )
|
|
59
60
|
(load-sekka-jisyo-f
|
60
61
|
f
|
61
62
|
(target.gsub #/[.]db$/ "") ;; drop ".db" suffix
|
62
|
-
)))
|
63
|
+
)))
|
64
|
+
"r:UTF-8")
|
63
65
|
|
64
66
|
|
65
67
|
(define (dump-sekka-jisyo sekka-file)
|
@@ -72,7 +74,8 @@ core.evalStr( <<";;END-OF-SCRIPT" )
|
|
72
74
|
(lambda (f)
|
73
75
|
(restore-sekka-jisyo-f
|
74
76
|
f
|
75
|
-
target)))
|
77
|
+
target)))
|
78
|
+
"r:UTF-8")
|
76
79
|
|
77
80
|
|
78
81
|
(define (display-help)
|
@@ -80,11 +83,11 @@ core.evalStr( <<";;END-OF-SCRIPT" )
|
|
80
83
|
(print " sekka-jisyo convertA SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data included)")
|
81
84
|
(print " sekka-jisyo convertN SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data excluded)")
|
82
85
|
(print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.tch ... load SEKKA-JISYO to Tokyo Cabinet DB")
|
83
|
-
(print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.db ... load SEKKA-JISYO to
|
86
|
+
(print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.db ... load SEKKA-JISYO to gdbm DB")
|
84
87
|
(print " sekka-jisyo load SEKKA-JISYO.X redis:[hostname] ... load SEKKA-JISYO to redis DB on [hostname]")
|
85
88
|
(print " sekka-jisyo load SEKKA-JISYO.X redis: ... load SEKKA-JISYO to redis DB on localhost")
|
86
89
|
(print " sekka-jisyo dump SEKKA-JISYO.X.tch ... dump Tokyo Cabinet DB to DUMPDATA(STDOUT)")
|
87
|
-
(print " sekka-jisyo dump SEKKA-JISYO.X.db ... dump
|
90
|
+
(print " sekka-jisyo dump SEKKA-JISYO.X.db ... dump gdbm to DUMPDATA(STDOUT)")
|
88
91
|
(print " sekka-jisyo dump redis:[hostname] ... dump redis DB on [hostname] to DUMPDATA(STDOUT)")
|
89
92
|
(print " sekka-jisyo dump redis: ... dump redis DB on localhost to DUMPDATE(STDOUT)")
|
90
93
|
(print " sekka-jisyo restore SEKKA-JISYO.X.tsv SEKKA-JISYO.X.tch ... restore Tokyo Cabinet DB from tsv-file")
|
@@ -97,7 +100,7 @@ core.evalStr( <<";;END-OF-SCRIPT" )
|
|
97
100
|
((rxmatch #/[.]tch/ filename)
|
98
101
|
(values 'tokyocabinet filename))
|
99
102
|
((rxmatch #/[.]db$/ filename)
|
100
|
-
(values '
|
103
|
+
(values 'gdbm filename))
|
101
104
|
((rxmatch #/^redis:(.*)$/ filename)
|
102
105
|
=> (lambda (m)
|
103
106
|
(let1 str (rxmatch-substring m 1)
|
data/bin/sekka-server
CHANGED
@@ -22,7 +22,11 @@ if ENV.has_key?( 'SEKKA_AZIK' )
|
|
22
22
|
end
|
23
23
|
|
24
24
|
DICTSIZE = if ENV.has_key?( 'SEKKA_LARGE' )
|
25
|
-
|
25
|
+
if 1 == ENV[ 'SEKKA_LARGE' ].to_i
|
26
|
+
"LARGE"
|
27
|
+
else
|
28
|
+
"SMALL"
|
29
|
+
end
|
26
30
|
else
|
27
31
|
"SMALL"
|
28
32
|
end
|
@@ -32,6 +36,9 @@ TC_FILE = DICTDIR + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.tch" + TC_OPTS
|
|
32
36
|
TSVFILE = DICTDIR + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.tsv"
|
33
37
|
SUMFILE = DICTDIR + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.md5"
|
34
38
|
|
39
|
+
GDBM_FILE = DICTDIR + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.db"
|
40
|
+
|
41
|
+
|
35
42
|
URLURL = DICTURL + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.url"
|
36
43
|
SUMURL = DICTURL + "/SEKKA-JISYO.#{DICTSIZE}.#{DICTTYPE}.md5"
|
37
44
|
|
@@ -49,6 +56,8 @@ def getSekkaDbInfo( env )
|
|
49
56
|
[ :redis, dictSource ]
|
50
57
|
elsif m = ENV['SEKKA_DB'].match( /^tokyo[a-z]+$/ )
|
51
58
|
[ :tokyocabinet, nil ]
|
59
|
+
elsif m = ENV['SEKKA_DB'].match( /^gdbm$/i )
|
60
|
+
[ :gdbm, nil ]
|
52
61
|
else
|
53
62
|
raise RuntimeError, "Error: env var SEKKA_DB requires [redis:hostname] or [redis:] or [tokyocabinet]"
|
54
63
|
end
|
@@ -62,6 +71,13 @@ def checkJisyoIsInstalled( dictType, dictSource )
|
|
62
71
|
STDERR.printf( "Info: Checking SEKKA jisyo on #{dictType} server...\n" )
|
63
72
|
begin
|
64
73
|
result = case dictType
|
74
|
+
when :gdbm
|
75
|
+
require 'sekka/kvs'
|
76
|
+
tc = Kvs.new( :gdbm )
|
77
|
+
tc.open( dictSource )
|
78
|
+
ret = tc.get( key )
|
79
|
+
tc.close()
|
80
|
+
ret
|
65
81
|
when :tokyocabinet
|
66
82
|
require 'tokyocabinet'
|
67
83
|
require 'sekka/kvs'
|
@@ -147,6 +163,19 @@ def main
|
|
147
163
|
( dictType, dictSource ) = getSekkaDbInfo( ENV )
|
148
164
|
|
149
165
|
case dictType
|
166
|
+
when :gdbm
|
167
|
+
# GDBMに辞書が投入済みか確認する
|
168
|
+
ok = checkJisyoIsInstalled( dictType, GDBM_FILE )
|
169
|
+
unless ok
|
170
|
+
# tsvファイルをuploadする
|
171
|
+
STDERR.printf( "Info: Uploading...\n" )
|
172
|
+
cmd = sprintf( "sekka-jisyo restore %s %s", TSVFILE, GDBM_FILE )
|
173
|
+
STDERR.printf( "Command : %s\n", cmd )
|
174
|
+
system( cmd )
|
175
|
+
end
|
176
|
+
STDERR.printf( "Info: [OK]\n" )
|
177
|
+
dictSource = GDBM_FILE
|
178
|
+
|
150
179
|
when :tokyocabinet
|
151
180
|
# TokyoCabinetに辞書が投入済みか確認する
|
152
181
|
ok = checkJisyoIsInstalled( dictType, TC_FILE )
|
data/emacs/sekka.el
CHANGED
@@ -77,7 +77,7 @@
|
|
77
77
|
:type 'integer
|
78
78
|
:group 'sekka)
|
79
79
|
|
80
|
-
(defcustom sekka-realtime-guide-limit-lines
|
80
|
+
(defcustom sekka-realtime-guide-limit-lines 3
|
81
81
|
"最後に変換した行から N 行離れたらリアルタイムガイド表示が止まる"
|
82
82
|
:type 'integer
|
83
83
|
:group 'sekka)
|
@@ -280,14 +280,16 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
280
280
|
|
281
281
|
|
282
282
|
(defun sekka-construct-curl-argstr (arg-alist)
|
283
|
-
(apply
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
283
|
+
(apply
|
284
|
+
'append
|
285
|
+
(mapcar
|
286
|
+
(lambda (x)
|
287
|
+
(list "--data" (format "%s=%s"
|
288
|
+
(car x)
|
289
|
+
(if (stringp (cdr x))
|
290
|
+
(http-url-encode (cdr x) 'utf-8)
|
291
|
+
(cdr x)))))
|
292
|
+
arg-alist)))
|
291
293
|
|
292
294
|
;; test-code
|
293
295
|
(when nil
|
@@ -296,7 +298,8 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
296
298
|
("yomi" . "kanji")
|
297
299
|
("limit" . 2)
|
298
300
|
("method" . "normal")
|
299
|
-
))
|
301
|
+
))
|
302
|
+
)
|
300
303
|
|
301
304
|
|
302
305
|
;;
|
@@ -345,16 +348,63 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
345
348
|
(sekka-next-sekka-server)
|
346
349
|
nil)
|
347
350
|
result)))
|
351
|
+
(let ((arg-alist
|
352
|
+
(cons
|
353
|
+
`(userid . ,sekka-login-name)
|
354
|
+
arg-alist)))
|
355
|
+
(or
|
356
|
+
(one-request func-name arg-alist)
|
357
|
+
(one-request func-name arg-alist)
|
358
|
+
(one-request func-name arg-alist)
|
359
|
+
(concat
|
360
|
+
"Error: All sekka-server are down. "
|
361
|
+
" " sekka-server-url
|
362
|
+
" " sekka-server-url-2
|
363
|
+
" " sekka-server-url-3))))
|
364
|
+
|
365
|
+
(defun sekka-rest-request-by-curl (func-name arg-alist)
|
366
|
+
(let* ((lst
|
367
|
+
(append
|
368
|
+
(if (< 0 (length sekka-no-proxy-hosts))
|
369
|
+
(list "--noproxy" sekka-no-proxy-hosts)
|
370
|
+
nil)
|
371
|
+
(sekka-construct-curl-argstr (cons
|
372
|
+
'(format . "sexp")
|
373
|
+
arg-alist))))
|
374
|
+
(buffername "*sekka-output*")
|
375
|
+
(result ""))
|
376
|
+
(sekka-debug-print (format "arg-lst :[%S]\n" lst))
|
377
|
+
(progn
|
378
|
+
(apply
|
379
|
+
'call-process
|
380
|
+
sekka-curl
|
381
|
+
nil buffername nil
|
382
|
+
"--silent" "--show-error"
|
383
|
+
"--max-time" (format "%d" sekka-server-timeout)
|
384
|
+
"--insecure"
|
385
|
+
"--header" "Content-Type: application/x-www-form-urlencoded"
|
386
|
+
(concat current-sekka-server-url func-name)
|
387
|
+
lst)
|
388
|
+
(setq result
|
389
|
+
(with-current-buffer buffername
|
390
|
+
(buffer-substring-no-properties (point-min) (point-max))))
|
391
|
+
(kill-buffer buffername)
|
392
|
+
result)))
|
393
|
+
|
348
394
|
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
395
|
+
(when nil
|
396
|
+
;; unit test
|
397
|
+
(setq sekka-curl "curl")
|
398
|
+
(setq sekka-login-name (user-login-name))
|
399
|
+
(setq current-sekka-server-url "http://localhost:12929/")
|
400
|
+
(sekka-rest-request-by-curl
|
401
|
+
"henkan"
|
402
|
+
'(
|
403
|
+
("yomi" . "Nihon")
|
404
|
+
(limit . "1")
|
405
|
+
(method . "normal")
|
406
|
+
("userid" . "kiyoka")))
|
407
|
+
)
|
358
408
|
|
359
409
|
|
360
410
|
|
@@ -374,31 +424,8 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
374
424
|
;; "(\"初回起動\", \"諸快気堂\", \"諸開基堂\", \"しょかいきどう\", \"ショカイキドウ\")"
|
375
425
|
))
|
376
426
|
;; 実際のサーバに接続する
|
377
|
-
(
|
378
|
-
|
379
|
-
sekka-curl " --silent --show-error "
|
380
|
-
(if (< 0 (length sekka-no-proxy-hosts))
|
381
|
-
(concat " --noproxy " sekka-no-proxy-hosts)
|
382
|
-
"")
|
383
|
-
(format " --max-time %d " sekka-server-timeout)
|
384
|
-
" --insecure "
|
385
|
-
" --header 'Content-Type: application/x-www-form-urlencoded' "
|
386
|
-
(format "%s%s " current-sekka-server-url func-name)
|
387
|
-
(sekka-construct-curl-argstr (cons
|
388
|
-
'("format" . "sexp")
|
389
|
-
arg-alist))
|
390
|
-
(format "--data 'userid=%s' " sekka-login-name))))
|
391
|
-
|
392
|
-
(sekka-debug-print (format "curl-command :%s\n" command))
|
393
|
-
|
394
|
-
(let (
|
395
|
-
(result
|
396
|
-
(shell-command-to-string
|
397
|
-
command)))
|
398
|
-
|
399
|
-
(sekka-debug-print (format "curl-result-sexp :%s\n" result))
|
400
|
-
result))))
|
401
|
-
|
427
|
+
(sekka-rest-request-by-curl func-name arg-alist)))
|
428
|
+
|
402
429
|
;;
|
403
430
|
;; 現在時刻をUNIXタイムを返す(単位は秒)
|
404
431
|
;;
|
@@ -422,7 +449,7 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
|
|
422
449
|
|
423
450
|
(let (
|
424
451
|
(result (sekka-rest-request "henkan" `((yomi . ,yomi)
|
425
|
-
(limit . ,limit)
|
452
|
+
(limit . ,(format "%d" limit))
|
426
453
|
(method . ,sekka-roman-method)))))
|
427
454
|
(sekka-debug-print (format "henkan-result:%S\n" result))
|
428
455
|
(if (eq (string-to-char result) ?\( )
|
@@ -1621,7 +1648,7 @@ point から行頭方向に同種の文字列が続く間を漢字変換しま
|
|
1621
1648
|
(setq default-input-method "japanese-sekka")
|
1622
1649
|
|
1623
1650
|
(defconst sekka-version
|
1624
|
-
"1.
|
1651
|
+
"1.5.0" ;;SEKKA-VERSION
|
1625
1652
|
)
|
1626
1653
|
(defun sekka-version (&optional arg)
|
1627
1654
|
"入力モード変更"
|
data/lib/sekka/jisyo-db.nnd
CHANGED
data/lib/sekka/kvs.rb
CHANGED
@@ -49,11 +49,11 @@ class Kvs
|
|
49
49
|
@redisFlag = false
|
50
50
|
end
|
51
51
|
|
52
|
-
@
|
52
|
+
@gdbmFlag = true
|
53
53
|
begin
|
54
|
-
require '
|
54
|
+
require 'gdbm'
|
55
55
|
rescue LoadError
|
56
|
-
@
|
56
|
+
@gdbmFlag = false
|
57
57
|
end
|
58
58
|
|
59
59
|
@dbtype = dbtype
|
@@ -73,11 +73,11 @@ class Kvs
|
|
73
73
|
when :memcache
|
74
74
|
# do nothing
|
75
75
|
|
76
|
-
when :
|
77
|
-
if @
|
76
|
+
when :gdbm
|
77
|
+
if @gdbmFlag
|
78
78
|
# do nothing
|
79
79
|
else
|
80
|
-
raise RuntimeError, "Kvs.new() missed require( '
|
80
|
+
raise RuntimeError, "Kvs.new() missed require( 'gdbm' )."
|
81
81
|
end
|
82
82
|
|
83
83
|
# do nothing
|
@@ -101,8 +101,11 @@ class Kvs
|
|
101
101
|
@db = MemCache.new( name,
|
102
102
|
:connect_timeout => 1000.0,
|
103
103
|
:timeout => 1000.0 )
|
104
|
-
when :
|
105
|
-
|
104
|
+
when :gdbm
|
105
|
+
if not name.match( /.db$/ )
|
106
|
+
name = name + ".db"
|
107
|
+
end
|
108
|
+
@db = GDBM.new( name, nil, GDBM::FAST | GDBM::WRCREAT )
|
106
109
|
when :pure
|
107
110
|
@name = name
|
108
111
|
if File.exist?( @name )
|
@@ -138,7 +141,7 @@ class Kvs
|
|
138
141
|
def pure_put!( key, value, timeout = 0 )
|
139
142
|
if 0 < key.size
|
140
143
|
case @dbtype
|
141
|
-
when :tokyocabinet, :
|
144
|
+
when :tokyocabinet, :gdbm, :redis
|
142
145
|
@db[ key.force_encoding("ASCII-8BIT") ] = value.force_encoding("ASCII-8BIT")
|
143
146
|
when :memcache
|
144
147
|
@db.set( key.force_encoding("ASCII-8BIT"), value.force_encoding("ASCII-8BIT"), timeout )
|
@@ -176,7 +179,7 @@ class Kvs
|
|
176
179
|
|
177
180
|
def clear()
|
178
181
|
case @dbtype
|
179
|
-
when :tokyocabinet, :
|
182
|
+
when :tokyocabinet, :gdbm, :pure
|
180
183
|
@db.clear
|
181
184
|
when :redis
|
182
185
|
@db.flushall
|
@@ -190,7 +193,7 @@ class Kvs
|
|
190
193
|
# return array of key string
|
191
194
|
def keys()
|
192
195
|
case @dbtype
|
193
|
-
when :tokyocabinet, :
|
196
|
+
when :tokyocabinet, :gdbm, :redis
|
194
197
|
@db.keys.map { |k|
|
195
198
|
k.force_encoding("UTF-8")
|
196
199
|
}
|
@@ -215,7 +218,7 @@ class Kvs
|
|
215
218
|
}
|
216
219
|
when :memcache
|
217
220
|
raise RuntimeError, "Kvs#forward_match_keys method was not implemented for memcache."
|
218
|
-
when :
|
221
|
+
when :gdbm, :pure
|
219
222
|
self.keys( ).select {|key|
|
220
223
|
key.match( "^" + prefix )
|
221
224
|
}
|
@@ -226,7 +229,7 @@ class Kvs
|
|
226
229
|
|
227
230
|
def close()
|
228
231
|
case @dbtype
|
229
|
-
when :tokyocabinet, :
|
232
|
+
when :tokyocabinet, :gdbm
|
230
233
|
@db.close
|
231
234
|
when :memcache, :redis
|
232
235
|
# do nothing
|
data/lib/sekka/sekkaversion.rb
CHANGED
data/lib/sekkaserver.rb
CHANGED
@@ -37,7 +37,6 @@
|
|
37
37
|
require 'rack'
|
38
38
|
require 'nendo'
|
39
39
|
require 'eventmachine'
|
40
|
-
require 'syslog'
|
41
40
|
require 'uri'
|
42
41
|
require 'date'
|
43
42
|
require 'sekkaconfig'
|
@@ -51,7 +50,13 @@ module SekkaServer
|
|
51
50
|
@core = Nendo::Core.new()
|
52
51
|
@core.loadInitFile
|
53
52
|
@core.disableRuntimeCheck( )
|
54
|
-
|
53
|
+
begin
|
54
|
+
require 'syslog'
|
55
|
+
@core.evalStr( "(use debug.syslog)" )
|
56
|
+
rescue LoadError
|
57
|
+
STDERR.printf( "Sekka Warning: this platform does not support 'syslog'...\n" )
|
58
|
+
@core.evalStr( "(use debug.null)" )
|
59
|
+
end
|
55
60
|
@core.evalStr( "(use sekka.henkan)" )
|
56
61
|
@core.evalStr( '(define (writeToString sexp) (write-to-string sexp))' )
|
57
62
|
@core.evalStr( '(export-to-ruby writeToString)' )
|
data/test/henkan-bench.nnd
CHANGED
data/test/henkan-main.nnd
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
(set! target "./test.tch"))
|
55
55
|
((eq? dbtype 'redis)
|
56
56
|
(set! target "localhost"))
|
57
|
-
((eq? dbtype '
|
57
|
+
((eq? dbtype 'gdbm)
|
58
58
|
(set! target "./test"))
|
59
59
|
((eq? dbtype 'pure)
|
60
60
|
(set! target "./test.dump"))
|
@@ -70,22 +70,23 @@
|
|
70
70
|
(with-open "./test/skk-jisyo-in-1.txt"
|
71
71
|
(lambda (_input)
|
72
72
|
(let1 sekka-jisyo-data
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
73
|
+
(with-open #?="./test/sekka-jisyo-out-1.txt"
|
74
|
+
(lambda (f)
|
75
|
+
(read f))
|
76
|
+
"r:UTF-8")
|
77
|
+
(test* "Create test jisyo"
|
78
|
+
sekka-jisyo-data
|
79
|
+
(convert-skk-jisyo-f _input))
|
80
|
+
|
81
|
+
(test* "default KVS type" 'tokyocabinet (get-kvs-type))
|
82
|
+
|
83
|
+
(set-kvs-type #?=dbtype)
|
84
|
+
(test* "changed KVS type" dbtype (get-kvs-type))
|
85
|
+
|
86
|
+
(let1 sio (StringIO.new (string-join sekka-jisyo-data "\n"))
|
87
|
+
(sio.set_encoding "utf-8")
|
88
|
+
(load-sekka-jisyo-f sio target))))
|
89
|
+
"r:UTF-8")
|
89
90
|
|
90
91
|
|
91
92
|
;;-------------------------------------------------------------------
|
@@ -98,7 +99,7 @@
|
|
98
99
|
(_output2.set_encoding "utf-8")
|
99
100
|
(when (or (eq? dbtype 'tokyocabinet)
|
100
101
|
(eq? dbtype 'redis)
|
101
|
-
(eq? dbtype '
|
102
|
+
(eq? dbtype 'gdbm)
|
102
103
|
(eq? dbtype 'pure))
|
103
104
|
(begin
|
104
105
|
(test-section "dump db")
|
@@ -126,7 +127,9 @@
|
|
126
127
|
(lambda (f) (f.write (_output2.string)))
|
127
128
|
"w")
|
128
129
|
(Digest::MD5.hexdigest
|
129
|
-
(_output2.string))))))))
|
130
|
+
(_output2.string))))))))
|
131
|
+
"r:UTF-8")
|
132
|
+
|
130
133
|
|
131
134
|
|
132
135
|
|
@@ -140,9 +143,9 @@
|
|
140
143
|
((eq? dbtype 'redis)
|
141
144
|
(kvs.open target)
|
142
145
|
(require "redis"))
|
143
|
-
((eq? dbtype '
|
146
|
+
((eq? dbtype 'gdbm)
|
144
147
|
(kvs.open target)
|
145
|
-
(require "
|
148
|
+
(require "gdbm"))
|
146
149
|
((eq? dbtype 'pure)
|
147
150
|
(kvs.open target))
|
148
151
|
((eq? dbtype 'memcache)
|
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sekka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kiyoka Nishiyama
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: memcache-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,70 +56,70 @@ dependencies:
|
|
56
56
|
name: distributed-trie
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rack
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: ruby-progressbar
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: eventmachine
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: memcache-client
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
@@ -140,42 +140,42 @@ dependencies:
|
|
140
140
|
name: distributed-trie
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - ">="
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: '0'
|
146
146
|
type: :runtime
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - ">="
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rack
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
|
-
- -
|
157
|
+
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
160
|
type: :runtime
|
161
161
|
prerelease: false
|
162
162
|
version_requirements: !ruby/object:Gem::Requirement
|
163
163
|
requirements:
|
164
|
-
- -
|
164
|
+
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
167
|
- !ruby/object:Gem::Dependency
|
168
168
|
name: ruby-progressbar
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - ">="
|
172
172
|
- !ruby/object:Gem::Version
|
173
173
|
version: '0'
|
174
174
|
type: :runtime
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
181
|
description: Sekka is a SKK like input method. Sekka server provides REST Based API.
|
@@ -190,7 +190,7 @@ extensions: []
|
|
190
190
|
extra_rdoc_files:
|
191
191
|
- README.md
|
192
192
|
files:
|
193
|
-
- .gemtest
|
193
|
+
- ".gemtest"
|
194
194
|
- COPYING
|
195
195
|
- Rakefile
|
196
196
|
- VERSION.yml
|
@@ -246,17 +246,17 @@ require_paths:
|
|
246
246
|
- lib
|
247
247
|
required_ruby_version: !ruby/object:Gem::Requirement
|
248
248
|
requirements:
|
249
|
-
- -
|
249
|
+
- - ">="
|
250
250
|
- !ruby/object:Gem::Version
|
251
251
|
version: 1.9.2
|
252
252
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
253
253
|
requirements:
|
254
|
-
- -
|
254
|
+
- - ">="
|
255
255
|
- !ruby/object:Gem::Version
|
256
256
|
version: '0'
|
257
257
|
requirements: []
|
258
258
|
rubyforge_project:
|
259
|
-
rubygems_version: 2.0.
|
259
|
+
rubygems_version: 2.0.14
|
260
260
|
signing_key:
|
261
261
|
specification_version: 4
|
262
262
|
summary: Sekka is a SKK like input method.
|