sekka 1.6.2 → 1.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2887ee7935af58c6a120baa0a4c5c2a0cbb45f36
4
- data.tar.gz: f176b203351a4a5e239680aad03b7da0bd8e1472
3
+ metadata.gz: ad1477c07c6d878c2b57f0d10314f671d9ea1f46
4
+ data.tar.gz: 88c1939f955d2a5fcdba849a347b029413d2e2c2
5
5
  SHA512:
6
- metadata.gz: 0952e5ff9710e90543043ded89983e06b0e2d8d5fc5a130a393fae20e381097c70667f5af9bfcd010fd4fe3a7700bd73579979345b6bf97fd6a73d049360bd12
7
- data.tar.gz: 4c99ab92b87bd229364548ca39ae726d6658eedeaa74b8799a4598a32f37a4b6463d3733880f9e9fe0bfdceb63057206d2c50332bf2ca0f427a310760c34949c
6
+ metadata.gz: 3687f875c98cc30572093464ad81cea73a9fc383610f838f2a2f43d3c6928ce921a75ae3fb462f9d838d0ad85c24211e5d8d35f0c675f85f3175bbe7e0162f14
7
+ data.tar.gz: 3be4b8feaf645dac3d85eb5f69cdfc848425f25ac6d279d39bcb31a504e4483cb93a28e42c7b4c3b27202eb9718089f1c16fd35b0b2d6406f00c638de3dea64a
data/.gitignore CHANGED
@@ -21,6 +21,7 @@
21
21
  /test.db
22
22
  /test.dump
23
23
  /test.kct
24
+ /test.ldb
24
25
  /test.log
25
26
  /test.record
26
27
  /test.tch
data/Rakefile CHANGED
@@ -23,7 +23,7 @@ require 'rake'
23
23
  require "bundler/gem_tasks"
24
24
  require 'jeweler2'
25
25
 
26
- dictVersion = "1.6.0"
26
+ dictVersion = "1.6.1"
27
27
 
28
28
 
29
29
  task :default => [:test] do
@@ -79,6 +79,9 @@ task :test do
79
79
  ["test.record", "test.tch", "test.db" ].each {|name|
80
80
  File.unlink( name ) if File.exist?( name )
81
81
  }
82
+ ["test.ldb"].each {|name|
83
+ FileUtils.rm_rf( name ) if File.exist?( name )
84
+ }
82
85
  files = []
83
86
  files << "./test/memcache.nnd"
84
87
  files << "./test/util.nnd"
@@ -94,19 +97,24 @@ task :test do
94
97
  files << "./test/henkan-main.nnd gdbm"
95
98
  when 'tokyocabinet'
96
99
  files << "./test/henkan-main.nnd tokyocabinet"
100
+ when 'leveldb'
101
+ files << "./test/henkan-main.nnd leveldb"
97
102
  when 'redis'
98
103
  files << "./test/redis.nnd"
99
104
  files << "./test/henkan-main.nnd redis"
100
105
  when 'pure'
101
106
  files << "./test/henkan-main.nnd pure"
107
+ files << "./test/henkan-main.nnd leveldb"
102
108
  when 'all'
103
109
  files << "./test/henkan-main.nnd gdbm"
104
110
  files << "./test/henkan-main.nnd tokyocabinet"
105
111
  files << "./test/henkan-main.nnd redis"
106
112
  files << "./test/henkan-main.nnd pure"
113
+ files << "./test/henkan-main.nnd leveldb"
107
114
  else # default
108
115
  files << "./test/henkan-main.nnd tokyocabinet"
109
116
  files << "./test/henkan-main.nnd pure"
117
+ files << "./test/henkan-main.nnd leveldb"
110
118
  end
111
119
  files.each {|filename|
112
120
  sh sprintf( "ruby -I ./lib -S nendo -I ./lib -d %s", filename )
@@ -119,10 +127,11 @@ task :bench do
119
127
  sh "time nendo -I ./lib ./test/henkan-bench.nnd"
120
128
  end
121
129
 
122
- task :alljisyo => [ :jisyo, :load, :dump, :md5 ]
130
+ task :alljisyo => [ :jisyo, :load, :dump, :load_leveldb, :md5 ]
123
131
 
124
132
  task :md5 do
125
- sh sprintf( "md5sum ./data/SEKKA-JISYO-%s.N.tsv > ./data/SEKKA-JISYO-%s.N.md5", dictVersion, dictVersion )
133
+ sh sprintf( "md5sum ./data/SEKKA-JISYO-%s.N.tsv > ./data/SEKKA-JISYO-%s.N.md5", dictVersion, dictVersion )
134
+ sh sprintf( "md5sum ./data/SEKKA-JISYO-%s.N.ldb.tar.gz > ./data/SEKKA-JISYO-%s.N.ldb.tar.gz.md5", dictVersion, dictVersion )
126
135
  end
127
136
 
128
137
  task :jisyo do
@@ -144,6 +153,11 @@ task :dump do
144
153
  sh sprintf( "ruby ./bin/sekka-jisyo dump ./data/SEKKA-JISYO.N.tch#xmsiz=1024m > ./data/SEKKA-JISYO-%s.N.tsv", dictVersion )
145
154
  end
146
155
 
156
+ task :load_leveldb do
157
+ # sh sprintf( "ruby ./bin/sekka-jisyo load ./data/SEKKA-JISYO.N ./data/SEKKA-JISYO-%s.N.ldb", dictVersion )
158
+ sh sprintf( "tar zcCf ./data ./data/SEKKA-JISYO-%s.N.ldb.tar.gz ./SEKKA-JISYO-%s.N.ldb" , dictVersion, dictVersion )
159
+ end
160
+
147
161
  # SKK-JISYO.hiragana-phrase はWikipediaから作られる。
148
162
  task :phrase => [ "/tmp/jawiki.txt.gz", "./data/wikipedia/jawiki.hiragana.txt" ] do
149
163
  sh "sort ./data/wikipedia/jawiki.hiragana.txt | uniq -c | sort > ./data/wikipedia/ranking.txt"
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 1
3
3
  :minor: 6
4
- :patch: 2
4
+ :patch: 3
data/bin/sekka-jisyo CHANGED
@@ -80,19 +80,21 @@ core.evalStr( <<";;END-OF-SCRIPT" )
80
80
 
81
81
  (define (display-help)
82
82
  (print "Usage : ")
83
- (print " sekka-jisyo convertA SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data included)")
84
- (print " sekka-jisyo convertN SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data excluded)")
85
- (print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.tch ... load SEKKA-JISYO to Tokyo Cabinet DB")
86
- (print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.db ... load SEKKA-JISYO to gdbm DB")
87
- (print " sekka-jisyo load SEKKA-JISYO.X redis:[hostname] ... load SEKKA-JISYO to redis DB on [hostname]")
88
- (print " sekka-jisyo load SEKKA-JISYO.X redis: ... load SEKKA-JISYO to redis DB on localhost")
89
- (print " sekka-jisyo dump SEKKA-JISYO.X.tch ... dump Tokyo Cabinet DB to DUMPDATA(STDOUT)")
90
- (print " sekka-jisyo dump SEKKA-JISYO.X.db ... dump gdbm to DUMPDATA(STDOUT)")
91
- (print " sekka-jisyo dump redis:[hostname] ... dump redis DB on [hostname] to DUMPDATA(STDOUT)")
92
- (print " sekka-jisyo dump redis: ... dump redis DB on localhost to DUMPDATE(STDOUT)")
93
- (print " sekka-jisyo restore SEKKA-JISYO.X.tsv SEKKA-JISYO.X.tch ... restore Tokyo Cabinet DB from tsv-file")
94
- (print " sekka-jisyo restore SEKKA-JISYO.X.tsv redis:[hostname] ... restore redis DB on [hostname] from tsv-file")
95
- (print " sekka-jisyo restore SEKKA-JISYO.X.tsv redis: ... restore redis DB on localhost from tsv-file"))
83
+ (print " sekka-jisyo convertA SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data included)")
84
+ (print " sekka-jisyo convertN SKK-JISYO.X > SEKKA-JISYO.X ... output SEKKA-JISYO to STDOUT(AZIK data excluded)")
85
+ (print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.tch ... load SEKKA-JISYO to Tokyo Cabinet DB")
86
+ (print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.db ... load SEKKA-JISYO to gdbm DB")
87
+ (print " sekka-jisyo load SEKKA-JISYO.X SEKKA-JISYO.X.ldb ... load SEKKA-JISYO to LevelDB")
88
+ (print " sekka-jisyo load SEKKA-JISYO.X redis:[hostname] ... load SEKKA-JISYO to redis DB on [hostname]")
89
+ (print " sekka-jisyo load SEKKA-JISYO.X redis: ... load SEKKA-JISYO to redis DB on localhost")
90
+ (print " sekka-jisyo dump SEKKA-JISYO.X.tch ... dump Tokyo Cabinet DB to DUMPDATA(STDOUT)")
91
+ (print " sekka-jisyo dump SEKKA-JISYO.X.db ... dump gdbm to DUMPDATA(STDOUT)")
92
+ (print " sekka-jisyo dump SEKKA-JISYO.X.ldb ... dump LevelDB to DUMPDATA(STDOUT)")
93
+ (print " sekka-jisyo dump redis:[hostname] ... dump redis DB on [hostname] to DUMPDATA(STDOUT)")
94
+ (print " sekka-jisyo dump redis: ... dump redis DB on localhost to DUMPDATE(STDOUT)")
95
+ (print " sekka-jisyo restore SEKKA-JISYO.X.tsv SEKKA-JISYO.X.tch ... restore Tokyo Cabinet DB from tsv-file")
96
+ (print " sekka-jisyo restore SEKKA-JISYO.X.tsv redis:[hostname] ... restore redis DB on [hostname] from tsv-file")
97
+ (print " sekka-jisyo restore SEKKA-JISYO.X.tsv redis: ... restore redis DB on localhost from tsv-file"))
96
98
 
97
99
 
98
100
  (define (analyze-kvs-type filename)
@@ -101,6 +103,8 @@ core.evalStr( <<";;END-OF-SCRIPT" )
101
103
  (values 'tokyocabinet filename))
102
104
  ((rxmatch #/[.]db$/ filename)
103
105
  (values 'gdbm filename))
106
+ ((rxmatch #/[.]ldb$/ filename)
107
+ (values 'leveldb filename))
104
108
  ((rxmatch #/^redis:(.*)$/ filename)
105
109
  => (lambda (m)
106
110
  (let1 str (rxmatch-substring m 1)
data/bin/sekka-server CHANGED
@@ -15,15 +15,20 @@ DICTURL = "https://raw.githubusercontent.com/kiyoka/sekka/master/public_dict/" +
15
15
 
16
16
  PIDFILE = DICTDIR + "/pid"
17
17
 
18
- TC_OPTS = "#xmsiz=256m"
19
- TC_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.tch%s", DICTDIR, SekkaVersion.dictVersion, TC_OPTS )
20
- TSVFILE = sprintf( "%s/SEKKA-JISYO-%s.N.tsv", DICTDIR, SekkaVersion.dictVersion )
21
- SUMFILE = sprintf( "%s/SEKKA-JISYO-%s.N.md5", DICTDIR, SekkaVersion.dictVersion )
18
+ TC_OPTS = "#xmsiz=256m"
19
+ TC_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.tch%s", DICTDIR, SekkaVersion.dictVersion, TC_OPTS )
20
+ TSV_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.tsv", DICTDIR, SekkaVersion.dictVersion )
21
+ TSV_SUMFILE = sprintf( "%s/SEKKA-JISYO-%s.N.md5", DICTDIR, SekkaVersion.dictVersion )
22
+ LDB_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.ldb.tar.gz", DICTDIR, SekkaVersion.dictVersion )
23
+ LDB_SUMFILE = sprintf( "%s/SEKKA-JISYO-%s.N.ldb.tar.gz.md5", DICTDIR, SekkaVersion.dictVersion )
22
24
 
23
- GDBM_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.db", DICTDIR, SekkaVersion.dictVersion )
25
+ GDBM_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.db", DICTDIR, SekkaVersion.dictVersion )
26
+ LEVELDB_FILE = sprintf( "%s/SEKKA-JISYO-%s.N.ldb", DICTDIR, SekkaVersion.dictVersion )
24
27
 
25
- URLURL = sprintf( "%s/SEKKA-JISYO-%s.N.url", DICTURL, SekkaVersion.dictVersion )
26
- SUMURL = sprintf( "%s/SEKKA-JISYO-%s.N.md5", DICTURL, SekkaVersion.dictVersion )
28
+ TSV_URLURL = sprintf( "%s/SEKKA-JISYO-%s.N.url", DICTURL, SekkaVersion.dictVersion )
29
+ TSV_SUMURL = sprintf( "%s/SEKKA-JISYO-%s.N.md5", DICTURL, SekkaVersion.dictVersion )
30
+ LDB_URLURL = sprintf( "%s/SEKKA-JISYO-%s.N.ldb.tar.gz.url", DICTURL, SekkaVersion.dictVersion )
31
+ LDB_SUMURL = sprintf( "%s/SEKKA-JISYO-%s.N.ldb.tar.gz.md5", DICTURL, SekkaVersion.dictVersion )
27
32
 
28
33
  MEMCACHED = "localhost:11211" # memcahced
29
34
 
@@ -41,8 +46,10 @@ def getSekkaDbInfo( env )
41
46
  [ :tokyocabinet, nil ]
42
47
  elsif m = ENV['SEKKA_DB'].match( /^gdbm$/i )
43
48
  [ :gdbm, nil ]
49
+ elsif m = ENV['SEKKA_DB'].match( /^level[a-z]+$/i )
50
+ [ :leveldb, nil ]
44
51
  else
45
- raise RuntimeError, "Error: env var SEKKA_DB requires [redis:hostname] or [redis:] or [tokyocabinet]"
52
+ raise RuntimeError, "Error: env var SEKKA_DB requires [redis:hostname] or [redis:] or [tokyocabinet] or [leveldb]"
46
53
  end
47
54
  else
48
55
  [ :tokyocabinet, nil ]
@@ -56,18 +63,25 @@ def checkJisyoIsInstalled( dictType, dictSource )
56
63
  result = case dictType
57
64
  when :gdbm
58
65
  require 'sekka/kvs'
59
- tc = Kvs.new( :gdbm )
60
- tc.open( dictSource )
61
- ret = tc.get( key )
62
- tc.close()
66
+ kvs = Kvs.new( :gdbm )
67
+ kvs.open( dictSource )
68
+ ret = kvs.get( key )
69
+ kvs.close()
70
+ ret
71
+ when :leveldb
72
+ require 'sekka/kvs'
73
+ kvs = Kvs.new( :leveldb )
74
+ kvs.open( dictSource )
75
+ ret = kvs.get( key )
76
+ kvs.close()
63
77
  ret
64
78
  when :tokyocabinet
65
79
  require 'tokyocabinet'
66
80
  require 'sekka/kvs'
67
- tc = Kvs.new( :tokyocabinet )
68
- tc.open( dictSource )
69
- ret = tc.get( key )
70
- tc.close()
81
+ kvs = Kvs.new( :tokyocabinet )
82
+ kvs.open( dictSource )
83
+ ret = kvs.get( key )
84
+ kvs.close()
71
85
  ret
72
86
  when :redis
73
87
  begin
@@ -86,65 +100,75 @@ def checkJisyoIsInstalled( dictType, dictSource )
86
100
  end
87
101
  end
88
102
 
89
- def main
90
- if not File.directory?( DICTDIR )
91
- Dir.mkdir( DICTDIR )
92
- STDERR.printf( "Info: created directory [%s]\n", DICTDIR )
93
- end
94
-
95
- # sekka-server自身のpidを書きこむ(デーモン化したときの停止用)
96
- open( PIDFILE, "w" ) {|f|
97
- f.printf( "%d\n", Process.pid )
98
- }
99
-
100
- # 環境変数からHTTPプロキシサーバーの情報を取得する
101
- proxyHost = nil
102
- proxyPort = nil
103
- if ENV.key?( 'http_proxy' )
104
- uri = URI.parse ENV[ 'http_proxy' ]
105
- proxyPort = uri.port
106
- proxyHost = uri.host
107
- end
108
-
109
- if not File.exist?( TSVFILE )
103
+ def downloadFile( targetfile, sumfile, urlurl, sumurl )
104
+ if not File.exist?( targetfile )
110
105
  STDERR.printf( "Info: Downloading SEKKA-JISYO\n" )
111
106
  # 辞書をダウンロードする
112
- cmd = sprintf( "curl %s", URLURL )
107
+ cmd = sprintf( "curl %s", urlurl )
113
108
  STDERR.printf( "Command : %s\n", cmd )
114
- tsvurl = open( "|" + cmd ) { |f|
109
+ targeturl = open( "|" + cmd ) { |f|
115
110
  f.read
116
111
  }
117
- STDERR.printf( " download URL of tsv file : %s\n", tsvurl );
118
- cmd = sprintf( "curl -o %s %s", TSVFILE, tsvurl )
112
+ STDERR.printf( " download URL of target file : %s\n", targeturl );
113
+ cmd = sprintf( "curl -o %s %s", targetfile, targeturl )
119
114
  STDERR.printf( "Command : %s\n", cmd )
120
115
  system( cmd )
121
- cmd = sprintf( "curl -o %s %s", SUMFILE, SUMURL )
116
+ cmd = sprintf( "curl -o %s %s", sumfile, sumurl )
122
117
  STDERR.printf( "Command : %s\n", cmd )
123
118
  system( cmd )
124
119
 
125
120
  # チェックサムを確認する
126
121
  downloadSum = ""
127
- open( TSVFILE ) { |f|
122
+ open( targetfile ) { |f|
128
123
  dataBody = f.read
129
124
  downloadSum = Digest::MD5.hexdigest( dataBody )
130
125
  }
131
- open( SUMFILE ) { |f|
126
+ open( sumfile ) { |f|
132
127
  correctSum = f.readline.chomp.split[0]
133
128
  STDERR.printf( " downloaded file's MD5 : %s\n", downloadSum )
134
129
  STDERR.printf( " correct MD5 : %s\n", correctSum )
135
130
  if downloadSum == correctSum
136
- STDERR.printf( "Info: downloaded file [%s] verify OK.\n", TSVFILE )
131
+ STDERR.printf( "Info: downloaded file [%s] verify OK.\n", targetfile )
137
132
  else
138
- STDERR.printf( "Error: downloaded file [%s] verify NG.\n", TSVFILE )
139
- File.unlink( TSVFILE )
133
+ STDERR.printf( "Error: downloaded file [%s] verify NG.\n", targetfile )
134
+ File.unlink( targetfile )
140
135
  exit( 1 )
141
136
  end
142
137
  }
143
138
  end
139
+ end
140
+
141
+ def main
142
+ if not File.directory?( DICTDIR )
143
+ Dir.mkdir( DICTDIR )
144
+ STDERR.printf( "Info: created directory [%s]\n", DICTDIR )
145
+ end
146
+
147
+ # sekka-server自身のpidを書きこむ(デーモン化したときの停止用)
148
+ open( PIDFILE, "w" ) {|f|
149
+ f.printf( "%d\n", Process.pid )
150
+ }
151
+
152
+ # 環境変数からHTTPプロキシサーバーの情報を取得する
153
+ proxyHost = nil
154
+ proxyPort = nil
155
+ if ENV.key?( 'http_proxy' )
156
+ uri = URI.parse ENV[ 'http_proxy' ]
157
+ proxyPort = uri.port
158
+ proxyHost = uri.host
159
+ end
144
160
 
145
161
  # 環境変数から、DBの接続先情報を取得する。
146
162
  ( dictType, dictSource ) = getSekkaDbInfo( ENV )
147
163
 
164
+ # 必要なファイルをダウンロードする
165
+ case dictType
166
+ when :leveldb
167
+ downloadFile( LDB_FILE, LDB_SUMFILE, LDB_URLURL, LDB_SUMURL )
168
+ else
169
+ downloadFile( TSV_FILE, TSV_SUMFILE, TSV_URLURL, TSV_SUMURL )
170
+ end
171
+
148
172
  case dictType
149
173
  when :gdbm
150
174
  # GDBMに辞書が投入済みか確認する
@@ -152,20 +176,33 @@ def main
152
176
  unless ok
153
177
  # tsvファイルをuploadする
154
178
  STDERR.printf( "Info: Uploading...\n" )
155
- cmd = sprintf( "sekka-jisyo restore %s %s", TSVFILE, GDBM_FILE )
179
+ cmd = sprintf( "sekka-jisyo restore %s %s", TSV_FILE, GDBM_FILE )
156
180
  STDERR.printf( "Command : %s\n", cmd )
157
181
  system( cmd )
158
182
  end
159
183
  STDERR.printf( "Info: [OK]\n" )
160
184
  dictSource = GDBM_FILE
161
185
 
186
+ when :leveldb
187
+ # GDBMに辞書が展開済みか確認する
188
+ ok = checkJisyoIsInstalled( dictType, LDB_FILE )
189
+ unless ok
190
+ # tar.gzを展開する
191
+ STDERR.printf( "Info: Extracting...\n" )
192
+ cmd = sprintf( "tar zxCf %s %s", DICTDIR, LDB_FILE )
193
+ STDERR.printf( "Command : %s\n", cmd )
194
+ system( cmd )
195
+ end
196
+ STDERR.printf( "Info: [OK]\n" )
197
+ dictSource = LEVELDB_FILE
198
+
162
199
  when :tokyocabinet
163
200
  # TokyoCabinetに辞書が投入済みか確認する
164
201
  ok = checkJisyoIsInstalled( dictType, TC_FILE )
165
202
  unless ok
166
203
  # tsvファイルをuploadする
167
204
  STDERR.printf( "Info: Uploading...\n" )
168
- cmd = sprintf( "sekka-jisyo restore %s %s", TSVFILE, TC_FILE )
205
+ cmd = sprintf( "sekka-jisyo restore %s %s", TSV_FILE, TC_FILE )
169
206
  STDERR.printf( "Command : %s\n", cmd )
170
207
  system( cmd )
171
208
  end
@@ -178,7 +215,7 @@ def main
178
215
  unless ok
179
216
  # tsvファイルをuploadする。
180
217
  STDERR.printf( "Info: Uploading...\n" )
181
- cmd = sprintf( "sekka-jisyo restore %s %s:%s", TSVFILE, dictType, dictSource )
218
+ cmd = sprintf( "sekka-jisyo restore %s %s:%s", TSV_FILE, dictType, dictSource )
182
219
  STDERR.printf( "Command : %s\n", cmd )
183
220
  system( cmd )
184
221
  end
data/data/.gitignore CHANGED
@@ -10,6 +10,12 @@
10
10
  /SEKKA-JISYO-1.5.1.N.tsv
11
11
  /SEKKA-JISYO-1.6.0.N.md5
12
12
  /SEKKA-JISYO-1.6.0.N.tsv
13
+ /SEKKA-JISYO-1.6.1.N.ldb
14
+ /SEKKA-JISYO-1.6.1.N.ldb
15
+ /SEKKA-JISYO-1.6.1.N.ldb.tar.gz
16
+ /SEKKA-JISYO-1.6.1.N.ldb.tar.gz.md5
17
+ /SEKKA-JISYO-1.6.1.N.md5
18
+ /SEKKA-JISYO-1.6.1.N.tsv
13
19
  /SEKKA-JISYO.CUSTOM
14
20
  /SEKKA-JISYO.CUSTOM.tch
15
21
  /SEKKA-JISYO.CUSTOM~
@@ -31,6 +37,7 @@
31
37
  /SEKKA-JISYO.LARGE.tch
32
38
  /SEKKA-JISYO.N
33
39
  /SEKKA-JISYO.N.SMALL
40
+ /SEKKA-JISYO.N.ldb
34
41
  /SEKKA-JISYO.N.md5
35
42
  /SEKKA-JISYO.N.tch#xmsiz=1024m
36
43
  /SEKKA-JISYO.N.tsv
data/emacs/sekka.el CHANGED
@@ -3,7 +3,7 @@
3
3
  ;; Copyright (C) 2010-2014 Kiyoka Nishiyama
4
4
  ;;
5
5
  ;; Author: Kiyoka Nishiyama <kiyoka@sumibi.org>
6
- ;; Version: 1.6.2 ;;SEKKA-VERSION
6
+ ;; Version: 1.6.3 ;;SEKKA-VERSION
7
7
  ;; Keywords: ime, skk, japanese
8
8
  ;; Package-Requires: ((cl-lib "0.3") (concurrent "0.3.1") (popup "0.5.2"))
9
9
  ;; URL: https://github.com/kiyoka/sekka
@@ -1756,7 +1756,7 @@ point から行頭方向に同種の文字列が続く間を漢字変換しま
1756
1756
  (setq default-input-method "japanese-sekka")
1757
1757
 
1758
1758
  (defconst sekka-version
1759
- "1.6.2" ;;SEKKA-VERSION
1759
+ "1.6.3" ;;SEKKA-VERSION
1760
1760
  )
1761
1761
  (defun sekka-version (&optional arg)
1762
1762
  "入力モード変更"
data/lib/sekka/kvs.rb CHANGED
@@ -56,6 +56,13 @@ class Kvs
56
56
  @gdbmFlag = false
57
57
  end
58
58
 
59
+ @leveldbFlag = true
60
+ begin
61
+ require 'leveldb'
62
+ rescue LoadError
63
+ @leveldbFlag = false
64
+ end
65
+
59
66
  @dbtype = dbtype
60
67
  case dbtype
61
68
  when :tokyocabinet
@@ -80,7 +87,12 @@ class Kvs
80
87
  raise RuntimeError, "Kvs.new() missed require( 'gdbm' )."
81
88
  end
82
89
 
83
- # do nothing
90
+ when :leveldb
91
+ if @leveldbFlag
92
+ # do nothing
93
+ else
94
+ raise RuntimeError, "Kvs.new() missed require( 'leveldb' )."
95
+ end
84
96
 
85
97
  when :pure
86
98
  # do nothing
@@ -106,6 +118,11 @@ class Kvs
106
118
  name = name + ".db"
107
119
  end
108
120
  @db = GDBM.new( name, nil, GDBM::FAST | GDBM::WRCREAT )
121
+ when :leveldb
122
+ if not name.match( /.ldb$/ )
123
+ name = name + ".ldb"
124
+ end
125
+ @db = LevelDB::DB.new name
109
126
  when :pure
110
127
  @name = name
111
128
  if File.exist?( @name )
@@ -141,7 +158,7 @@ class Kvs
141
158
  def pure_put!( key, value, timeout = 0 )
142
159
  if 0 < key.size
143
160
  case @dbtype
144
- when :tokyocabinet, :gdbm, :redis
161
+ when :tokyocabinet, :gdbm, :redis, :leveldb
145
162
  @db[ key.force_encoding("ASCII-8BIT") ] = value.force_encoding("ASCII-8BIT")
146
163
  when :memcache
147
164
  @db.set( key.force_encoding("ASCII-8BIT"), value.force_encoding("ASCII-8BIT"), timeout )
@@ -181,6 +198,8 @@ class Kvs
181
198
  case @dbtype
182
199
  when :tokyocabinet, :gdbm, :pure
183
200
  @db.clear
201
+ when :leveldb
202
+ @db.clear!
184
203
  when :redis
185
204
  @db.flushall
186
205
  when :memcache
@@ -199,7 +218,7 @@ class Kvs
199
218
  }
200
219
  when :memcache
201
220
  raise RuntimeError, "Kvs#keys method was not implemented for memcache."
202
- when :pure
221
+ when :leveldb, :pure
203
222
  @db.keys
204
223
  else
205
224
  raise RuntimeError
@@ -218,7 +237,7 @@ class Kvs
218
237
  }
219
238
  when :memcache
220
239
  raise RuntimeError, "Kvs#forward_match_keys method was not implemented for memcache."
221
- when :gdbm, :pure
240
+ when :gdbm, :leveldb, :pure
222
241
  self.keys( ).select {|key|
223
242
  key.match( "^" + prefix )
224
243
  }
@@ -229,7 +248,7 @@ class Kvs
229
248
 
230
249
  def close()
231
250
  case @dbtype
232
- when :tokyocabinet, :gdbm
251
+ when :tokyocabinet, :leveldb, :gdbm
233
252
  @db.close
234
253
  when :memcache, :redis
235
254
  # do nothing
@@ -1,4 +1,4 @@
1
1
  class SekkaVersion
2
- def self.version() "1.6.2" end
3
- def self.dictVersion() "1.6.0" end
2
+ def self.version() "1.6.3" end
3
+ def self.dictVersion() "1.6.1" end
4
4
  end
@@ -0,0 +1 @@
1
+ bf19c45609846badd608722e657da607 ./data/SEKKA-JISYO-1.6.1.N.ldb.tar.gz
@@ -0,0 +1,2 @@
1
+ https://s3-ap-northeast-1.amazonaws.com/sekkadict/1.6.1/SEKKA-JISYO-1.6.1.N.ldb.tar.gz
2
+
@@ -0,0 +1 @@
1
+ 76471f8453ed7cdf975113fe7ea7fed0 ./data/SEKKA-JISYO-1.6.1.N.tsv
@@ -0,0 +1 @@
1
+ https://s3-ap-northeast-1.amazonaws.com/sekkadict/1.6.1/SEKKA-JISYO-1.6.1.N.tsv
data/test/henkan-main.nnd CHANGED
@@ -58,6 +58,8 @@
58
58
  (set! target "./test"))
59
59
  ((eq? dbtype 'pure)
60
60
  (set! target "./test.dump"))
61
+ ((eq? dbtype 'leveldb)
62
+ (set! target "./test.ldb"))
61
63
  ((eq? dbtype 'memcache)
62
64
  (error "memcached interface is obsolute."))
63
65
  (else
@@ -148,6 +150,8 @@
148
150
  (require "gdbm"))
149
151
  ((eq? dbtype 'pure)
150
152
  (kvs.open target))
153
+ ((eq? dbtype 'leveldb)
154
+ (kvs.open target))
151
155
  ((eq? dbtype 'memcache)
152
156
  (error "memcached interface is obsolute."))
153
157
  (else
@@ -1868,4 +1868,4 @@ M:みr /見/観;(字義:みわたす)/視;(字義:じっとみる)/診;(diagnose
1868
1868
  M:わけ /訳/和気;地名/理由;当て字/分け/分/譯;「訳」の旧字/戯奴
1869
1869
  M:わたしh /私
1870
1870
  M:を /小/緒/雄/男/牡/尾/悪/汚/惡;「悪」の旧字(人名用漢字)
1871
- SEKKA:VERSION 1.6.0
1871
+ SEKKA:VERSION 1.6.1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sekka
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.2
4
+ version: 1.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kiyoka Nishiyama
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-21 00:00:00.000000000 Z
11
+ date: 2015-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: eventmachine
@@ -207,6 +207,10 @@ files:
207
207
  - public_dict/1.5.0/SEKKA-JISYO.N.url
208
208
  - public_dict/1.6.0/SEKKA-JISYO-1.6.0.N.md5
209
209
  - public_dict/1.6.0/SEKKA-JISYO-1.6.0.N.url
210
+ - public_dict/1.6.1/SEKKA-JISYO-1.6.1.N.ldb.tar.gz.md5
211
+ - public_dict/1.6.1/SEKKA-JISYO-1.6.1.N.ldb.tar.gz.url
212
+ - public_dict/1.6.1/SEKKA-JISYO-1.6.1.N.md5
213
+ - public_dict/1.6.1/SEKKA-JISYO-1.6.1.N.url
210
214
  - script/sekkaserver.debian
211
215
  - sekka.gemspec
212
216
  - test/.gitignore