sekka 1.2.0 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/VERSION.yml +1 -1
- data/emacs/sekka.el +1 -1
- data/lib/sekka/convert-jisyo.nnd +8 -4
- data/lib/sekka/jisyo-db.nnd +34 -14
- data/lib/sekka/sekkaversion.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
data/VERSION.yml
CHANGED
data/emacs/sekka.el
CHANGED
data/lib/sekka/convert-jisyo.nnd
CHANGED
@@ -34,9 +34,10 @@
|
|
34
34
|
;;; $Id:
|
35
35
|
;;;
|
36
36
|
(use srfi-1)
|
37
|
+
(use util.list)
|
37
38
|
(use sekka.util)
|
38
39
|
(use sekka.roman-lib)
|
39
|
-
(require "progressbar")
|
40
|
+
(require "ruby-progressbar")
|
40
41
|
|
41
42
|
(define (expand-hiragana-phrase-entry key)
|
42
43
|
(let1 roman-list (gen-hiragana->roman-list key)
|
@@ -85,10 +86,13 @@
|
|
85
86
|
|
86
87
|
|
87
88
|
(define (convert-skk-jisyo-f f)
|
88
|
-
(let1 progress (ProgressBar.
|
89
|
-
|
89
|
+
(let1 progress (ProgressBar.create (alist->hash-table
|
90
|
+
`(
|
91
|
+
[title . "convert "]
|
92
|
+
[total . ,(file-length f)]
|
93
|
+
[output . ,STDERR])))
|
90
94
|
(define (gen-sekka-entries line)
|
91
|
-
(progress.
|
95
|
+
(progress.increment)
|
92
96
|
|
93
97
|
(let* ((line (line.sub #/\/$/ ""))
|
94
98
|
(fields (split-dict-line line)))
|
data/lib/sekka/jisyo-db.nnd
CHANGED
@@ -34,7 +34,8 @@
|
|
34
34
|
;;; $Id:
|
35
35
|
;;;
|
36
36
|
(use srfi-1)
|
37
|
-
(
|
37
|
+
(use util.list)
|
38
|
+
(require "ruby-progressbar")
|
38
39
|
(require "sekka/kvs")
|
39
40
|
(require "sekka/sekkaversion")
|
40
41
|
(require "distributedtrie")
|
@@ -45,6 +46,7 @@
|
|
45
46
|
(define okuri-ari-prefix "IK")
|
46
47
|
(define okuri-nashi-prefix "Ik")
|
47
48
|
(define hiragana-phrase-prefix "Ih")
|
49
|
+
(define progressbar-format "%E |%B| %p%% %t")
|
48
50
|
|
49
51
|
;; KVS type setting
|
50
52
|
(define *kvs-type* 'tokyocabinet) ;; default
|
@@ -78,7 +80,7 @@
|
|
78
80
|
(when (= 0 (% i 100))
|
79
81
|
(trie.commit!))
|
80
82
|
(when progress
|
81
|
-
(progress.
|
83
|
+
(progress.increment)))
|
82
84
|
keylist))
|
83
85
|
trie.commit!)
|
84
86
|
|
@@ -97,14 +99,20 @@
|
|
97
99
|
(push! okuri-ari-list k)
|
98
100
|
(push! okuri-nashi-list k))))
|
99
101
|
(when progress
|
100
|
-
(progress.
|
102
|
+
(progress.increment)))
|
101
103
|
keylist)
|
102
104
|
(values okuri-ari-list
|
103
105
|
okuri-nashi-list
|
104
106
|
hiragana-phrase-list)))
|
105
107
|
|
106
108
|
(let1 progress (if displayProgress
|
107
|
-
(ProgressBar.
|
109
|
+
(ProgressBar.create (alist->hash-table
|
110
|
+
`(
|
111
|
+
[title . "trie-tree "]
|
112
|
+
[total . ,(* 2 (length keylist))]
|
113
|
+
[output . ,STDERR]
|
114
|
+
[format . ,progressbar-format]
|
115
|
+
)))
|
108
116
|
#f)
|
109
117
|
(receive (okuri-ari-list
|
110
118
|
okuri-nashi-list
|
@@ -112,12 +120,12 @@
|
|
112
120
|
(grouping-keylist keylist progress)
|
113
121
|
|
114
122
|
(when progress
|
115
|
-
(progress.
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
123
|
+
(progress.progress= (+ (length keylist)
|
124
|
+
(- (length keylist)
|
125
|
+
(+
|
126
|
+
(length okuri-ari-list)
|
127
|
+
(length okuri-nashi-list)
|
128
|
+
(length hiragana-phrase-list))))))
|
121
129
|
|
122
130
|
(let1 trie (DistributedTrie::Trie.new kvs (+ okuri-ari-prefix ":" userid ":"))
|
123
131
|
(trie-add-autocommit trie okuri-ari-list progress))
|
@@ -164,7 +172,13 @@
|
|
164
172
|
(define (load-sekka-jisyo-f f filename)
|
165
173
|
(define keylist '())
|
166
174
|
(define (create-keylist kvs f)
|
167
|
-
(let1 progress (ProgressBar.
|
175
|
+
(let1 progress (ProgressBar.create (alist->hash-table
|
176
|
+
`(
|
177
|
+
[title . "data-body "]
|
178
|
+
[total . ,(file-length f)]
|
179
|
+
[output . ,STDERR]
|
180
|
+
[format . ,progressbar-format]
|
181
|
+
)))
|
168
182
|
(for-each
|
169
183
|
(lambda (line)
|
170
184
|
(let* (
|
@@ -172,7 +186,7 @@
|
|
172
186
|
[fields (split-dict-line line)])
|
173
187
|
(push! keylist (first fields))
|
174
188
|
(append-entry master-prefix kvs (first fields) (second fields)))
|
175
|
-
(progress.
|
189
|
+
(progress.increment))
|
176
190
|
f)))
|
177
191
|
(let1 kvs (Kvs.new (get-kvs-type))
|
178
192
|
(kvs.open filename)
|
@@ -205,14 +219,20 @@
|
|
205
219
|
""
|
206
220
|
(second key-value))])
|
207
221
|
(kvs.put! key value)
|
208
|
-
(progress.
|
222
|
+
(progress.increment))
|
209
223
|
(when (not (f.eof))
|
210
224
|
(loop (f.readline.chomp)))))
|
211
225
|
|
212
226
|
|
213
227
|
(let1 total (file-length f)
|
214
228
|
(let ([kvs (Kvs.new (get-kvs-type))]
|
215
|
-
[progress (ProgressBar.
|
229
|
+
[progress (ProgressBar.create (alist->hash-table
|
230
|
+
`(
|
231
|
+
[title . "restore "]
|
232
|
+
[total . ,total]
|
233
|
+
[output . ,STDERR]
|
234
|
+
[format . ,progressbar-format]
|
235
|
+
)))])
|
216
236
|
(kvs.open filename-or-hostname)
|
217
237
|
(kvs.clear)
|
218
238
|
(restore f kvs progress)
|
data/lib/sekka/sekkaversion.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sekka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|