sekka 0.8.4 → 0.8.5

Sign up to get free protection for your applications and to get access to all the features.
data/emacs/sekka.el CHANGED
@@ -655,8 +655,8 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
655
655
  (setq sekka-last-fix insert-word)
656
656
 
657
657
  ;; 選択中の場所を装飾する。
658
- (overlay-put ov 'face 'default)
659
658
  (when select-mode
659
+ (overlay-put ov 'face 'default)
660
660
  (overlay-put ov 'face 'highlight))
661
661
  (setq sekka-markers (cons start end))
662
662
  (sekka-debug-print (format "insert:[%s] point:%d-%d\n" insert-word (marker-position start) (marker-position end))))))
@@ -838,19 +838,21 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
838
838
  (when (eq sym _type)
839
839
  (push x lst))))
840
840
  sekka-henkan-kouho-list)
841
- (sekka-debug-print (format "filterd-lst = %S\n" (reverse lst)))
842
- (car (reverse lst))))
841
+ (sekka-debug-print (format "filtered-lst = %S\n" (reverse lst)))
842
+ (if (null lst)
843
+ nil
844
+ (car (reverse lst)))))
843
845
 
844
846
  ;; 指定された type の候補が存在するか調べる
845
847
  (defun sekka-include-typep ( _type )
846
- (not (null (sekka-select-by-type-filter _type))))
848
+ (sekka-select-by-type-filter _type))
847
849
 
848
850
  ;; 指定された type の候補に強制的に切りかえる
849
851
  ;; 切りかえが成功したかどうかを t or nil で返す。
850
852
  (defun sekka-select-by-type ( _type )
851
853
  (let ((kouho (sekka-select-by-type-filter _type)))
852
- (if (null kouho)
853
- (begin
854
+ (if (not kouho)
855
+ (progn
854
856
  (cond
855
857
  ((eq _type 'j)
856
858
  (message "Sekka: 漢字の候補はありません。"))
@@ -862,7 +864,9 @@ non-nil で明示的に呼びだすまでGoogleIMEは起動しない。"
862
864
  (message "Sekka: 半角の候補はありません。"))
863
865
  ((eq _type 'z)
864
866
  (message "Sekka: 全角の候補はありません。"))
865
- nil))
867
+ ((eq _type 'n)
868
+ (message "Sekka: 数字混在の候補はありません.")))
869
+ nil)
866
870
  (let ((num (nth sekka-id-index kouho)))
867
871
  (setq sekka-cand-cur num)
868
872
  (sekka-select-update-display)
@@ -1413,7 +1417,7 @@ point から行頭方向に同種の文字列が続く間を漢字変換しま
1413
1417
  (setq default-input-method "japanese-sekka")
1414
1418
 
1415
1419
  (defconst sekka-version
1416
- "0.8.4" ;;SEKKA-VERSION
1420
+ "0.8.5" ;;SEKKA-VERSION
1417
1421
  )
1418
1422
  (defun sekka-version (&optional arg)
1419
1423
  "入力モード変更"
@@ -95,10 +95,10 @@
95
95
  ;; フォーマットエラー
96
96
  #f)
97
97
  ((or (is-hiragana (first fields))
98
- (rxmatch #/^([>あ-ん]+)$/ (first fields)))
98
+ (rxmatch #/^([>#あ-んー]+)$/ (first fields)))
99
99
  ;; 送り仮名なしデータ
100
100
  (expand-okuri-nashi-entry (first fields) (second fields)))
101
- ((rxmatch #/^([>あ-ん]+)([a-z])$/ (first fields))
101
+ ((rxmatch #/^([>あ-んー]+)([a-z])$/ (first fields))
102
102
  => (lambda (m)
103
103
  ;; 送り仮名ありデータ
104
104
  (expand-okuri-ari-entry (rxmatch-substring m 1)
@@ -107,6 +107,9 @@
107
107
  ((rxmatch #/[亜-瑤]+/ (first fields))
108
108
  ;; 漢字が1文字でも含まれている
109
109
  #f)
110
+ ((rxmatch #/[#]+/ (first fields))
111
+ ;; # が1文字でも含まれている
112
+ #f)
110
113
  (else
111
114
  (list (cons (first fields) (second fields)))))))
112
115
 
data/lib/sekka/henkan.nnd CHANGED
@@ -39,6 +39,7 @@
39
39
  (use sekka.convert-jisyo)
40
40
  (use sekka.jisyo-db)
41
41
  (use sekka.alphabet-lib)
42
+ (use sekka.sharp-number)
42
43
  (use sekka.google-ime)
43
44
  (require "sekka/approximatesearch")
44
45
 
@@ -163,6 +164,32 @@
163
164
  lst
164
165
  (take* lst limit)))))
165
166
 
167
+
168
+
169
+ ;; 送り仮名なし、かつ、数字で始まるキーワードの変換
170
+ (define (henkan-okuri-nashi-and-number userid kvs keyword limit)
171
+ ;; 数字部分を抜きだして '#' に変換
172
+ (let ([num-list (to-list (keyword.scan #/[0-9]+/))]
173
+ [replaced (keyword.gsub #/[0-9]+/ "#")])
174
+ ;; 辞書引きした結果の # 部分を 再度数値に戻す。
175
+ (let1 result (henkan-okuri-nashi userid kvs replaced limit)
176
+ (map
177
+ (lambda (entry)
178
+ (let* ([type-list (to-list (. (car entry) scan #/[#][0-9]/))]
179
+ [converted-list
180
+ (map
181
+ (lambda (_type _num)
182
+ (sekka-henkan-sharp-number _type _num))
183
+ type-list
184
+ num-list)]
185
+ [format-str (. (car entry) gsub #/[#][0-9]/ "%s")])
186
+ (cons
187
+ (apply sprintf
188
+ (cons format-str
189
+ converted-list))
190
+ (append (drop-right (cdr entry) 1)
191
+ (list 'n)))))
192
+ result))))
166
193
 
167
194
 
168
195
  ;; 送り仮名ありの変換
@@ -246,6 +273,16 @@
246
273
  kouho)))
247
274
 
248
275
 
276
+ ;; 数字だけで構成されるキーワードの変換
277
+ (define (henkan-number kvs keyword)
278
+ ;; 数字部分を抜きだして '#' に変換
279
+ `(
280
+ (,(sekka-henkan-sharp-number "#1" keyword) nil ,keyword n)
281
+ (,(sekka-henkan-sharp-number "#0" keyword) nil ,keyword n)
282
+ (,(sekka-henkan-sharp-number "#2" keyword) nil ,keyword n)
283
+ (,(sekka-henkan-sharp-number "#3" keyword) nil ,keyword n)))
284
+
285
+
249
286
  ;; keyword には ローマ字のみを受け付ける
250
287
  (define (sekka-henkan userid kvs keyword limit roman-method)
251
288
  ;; 変換候補にindex番号を付加する
@@ -284,6 +321,14 @@
284
321
  '()
285
322
  (henkan-hiragana kvs (sekka-downcase k) roman-method)))
286
323
  (henkan-alphabet kvs keyword))))))
324
+ ;; 10進数数値のみで構成されるキーワード
325
+ ((rxmatch #/^[0-9]+$/ keyword)
326
+ (henkan-number kvs keyword))
327
+ ;; 10進数数値で始まるキーワード
328
+ ((rxmatch #/^[0-9]+[0-9a-zA-Z@-]+$/ keyword)
329
+ (append
330
+ (henkan-okuri-nashi-and-number userid kvs keyword limit)
331
+ (henkan-alphabet kvs keyword)))
287
332
  ((not (null? (gen-roman->hiragana keyword roman-method)))
288
333
  (append
289
334
  (append
@@ -40,7 +40,7 @@
40
40
  (define masterid "MASTER")
41
41
  (define workid "WORK")
42
42
 
43
- (define alphabet-string "abcdefghijklmnopqrstuvwxyz>@;")
43
+ (define alphabet-string "abcdefghijklmnopqrstuvwxyz>@;#")
44
44
  (define alphabet-lower-list (to-list (alphabet-string.split "")))
45
45
  (define alphabet-upper-list (to-list (. (sekka-upcase alphabet-string) split "")))
46
46
  (define alphabet-pairs (append-map
@@ -77,7 +77,7 @@
77
77
  (define (create-hash keylist)
78
78
  (for-each
79
79
  (lambda (k)
80
- (when (rxmatch #/^[a-zA-Z^>-@`;+:'\-]+$/ k)
80
+ (when (rxmatch #/^[a-zA-Z#^>-@`\;+:'\-]+$/ k)
81
81
  (let1 sliced (sekka-downcase (k.slice 0 2))
82
82
  (when (= 2 sliced.size)
83
83
  (if (rxmatch #/[A-Z`+]$/ k)
@@ -302,6 +302,8 @@
302
302
  ("っる" "rru" "@ru" ";ru" )
303
303
  ("っれ" "rre" "@re" ";re" )
304
304
  ("っろ" "rro" "@ro" ";ro" )
305
+
306
+ ("#" "#")
305
307
  ))
306
308
 
307
309
  ;; 子音が2音入ったテーブル
@@ -1,6 +1,6 @@
1
1
  class SekkaVersion
2
2
  include Singleton
3
3
  def self.version
4
- "0.8.4"
4
+ "0.8.5"
5
5
  end
6
6
  end
@@ -0,0 +1,99 @@
1
+ :; #-*- mode: nendo; syntax: scheme -*-;;
2
+ ;;;
3
+ ;;; sharp-number.nnd - #0から#9までtypeでアラビア数字を漢数字等に変換する
4
+ ;;;
5
+ ;;; Copyright (c) 2011 Kiyoka Nishiyama <kiyoka@sumibi.org>
6
+ ;;;
7
+ ;;; Redistribution and use in source and binary forms, with or without
8
+ ;;; modification, are permitted provided that the following conditions
9
+ ;;; are met:
10
+ ;;;
11
+ ;;; 1. Redistributions of source code must retain the above copyright
12
+ ;;; notice, this list of conditions and the following disclaimer.
13
+ ;;;
14
+ ;;; 2. Redistributions in binary form must reproduce the above copyright
15
+ ;;; notice, this list of conditions and the following disclaimer in the
16
+ ;;; documentation and/or other materials provided with the distribution.
17
+ ;;;
18
+ ;;; 3. Neither the name of the authors nor the names of its contributors
19
+ ;;; may be used to endorse or promote products derived from this
20
+ ;;; software without specific prior written permission.
21
+ ;;;
22
+ ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ ;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ ;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ ;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ ;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ ;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+ ;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+ ;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+ ;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+ ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ ;;;
34
+ ;;; $Id:
35
+ ;;;
36
+ (use srfi-1)
37
+ (use sekka.alphabet-lib)
38
+
39
+ (define (sekka-henkan-kansuuji-sen num-str)
40
+ (let ([num-lst (reverse (map (lambda (x) x.to_i) (to-list (num-str.split ""))))]
41
+ [kurai1-lst (to-list (. "□十百千" split ""))]
42
+ [kan-vector (. "〇一二三四五六七八九" split "")])
43
+ (string-join
44
+ (reverse
45
+ (map
46
+ (lambda (num kurai1)
47
+ (case num
48
+ ((0)
49
+ "")
50
+ ((1)
51
+ (+
52
+ (if (eq? "□" kurai1)
53
+ (vector-ref kan-vector num)
54
+ kurai1)))
55
+ (else
56
+ (+
57
+ (if (eq? "□" kurai1)
58
+ (vector-ref kan-vector num)
59
+ (+ (vector-ref kan-vector num)
60
+ kurai1))))))
61
+ num-lst
62
+ kurai1-lst)))))
63
+
64
+
65
+
66
+ (define (sekka-henkan-kansuuji num-str)
67
+ (let ([kurai2-lst (cons "" (to-list (. "万億兆京" split "")))]
68
+ [sliced (map
69
+ (lambda (x) (x.reverse))
70
+ (to-list (num-str.reverse.scan #/[0-9][0-9]?[0-9]?[0-9]?/)))])
71
+ (string-join
72
+ (reverse
73
+ (map
74
+ (lambda (sen kurai2)
75
+ (if (rxmatch #/^[0]+$/ sen)
76
+ ""
77
+ (+
78
+ (sekka-henkan-kansuuji-sen sen)
79
+ kurai2)))
80
+ sliced
81
+ kurai2-lst)))))
82
+
83
+
84
+
85
+ ;; #0 から #9 の変換
86
+ (define (sekka-henkan-sharp-number type-str num-str)
87
+ ;; 平仮名->カタカナ 変換
88
+ (define (kurai-nashi str)
89
+ (str.tr "0123456789" "〇一二三四五六七八九"))
90
+
91
+ (case type-str
92
+ (("#1")
93
+ (gen-alphabet-han->zen num-str))
94
+ (("#2")
95
+ (kurai-nashi num-str))
96
+ (("#3")
97
+ (sekka-henkan-kansuuji num-str))
98
+ (else
99
+ num-str)))
data/test/henkan-main.nnd CHANGED
@@ -60,78 +60,44 @@
60
60
  ;;-------------------------------------------------------------------
61
61
  (test-section "Create jisyo for test suite")
62
62
 
63
- (let ((_input (StringIO.new
64
- (string-join
65
- '(
66
- "わたしh /私/"
67
- "おこなu /行/行な;※送り位置補正/"
68
- "へんかん /変換/返還/"
69
- "へんか /変化/返歌/"
70
- "へんかs /変化/"
71
- "しぜんげんご /自然言語/"
72
- "しぜんげんごしょり /自然言語処理/"
73
- "しぜんげんごりかい /自然言語理解/"
74
- "developer /デベロッパー/ディベロッパー/デベロッパ/"
75
- ">あん /案/"
76
- "{ /{/"
77
- "かっこ /確固/括弧/各個/各戸/確乎/羯鼓;雅楽の打楽器/格好/『』/【】/[]/〔〕/〈〉/《》/{}/「」/()/‘’/“”/"
78
- "こっか /国家;state/国歌;anthem.「-斉唱」/国花/骨化/國家;「国」旧字/黒化/刻下/】/)/]/』/"
79
- "! /!/感嘆符/"
80
- ". /./・/。/…;.../"
81
- "* /*/※/×/"
82
- "? /?/"
83
- "/ ///÷/"
84
- "!= /≠/"
85
- "こーひー /コーヒー/"
86
- "かに /蟹/可児/蠏/"
87
- "かんい /簡易/官位/冠位;-十二階/漢医;漢方医/敢為/官医/寛衣/換位/簡意/"
88
- "いっち /一致/"
89
- "いっち /イッチ/"
90
- "えr /得/獲;NB:「とr」と同形/選;NB:「よr」「すぐr」と同形/"
91
- "を /小/緒/雄/男/牡/尾/悪/汚/惡;「悪」の旧字(人名用漢字)/"
92
- "みr /見/観;(字義:みわたす)/視;(字義:じっとみる)/診;(diagnose) 患者を診る/看;(nurse) 病母を看る/觀;「観」の旧字/"
93
- "wake /ウェイク/"
94
- "わけ /訳/和気;地名/理由;当て字/分け/分/譯;「訳」の旧字/戯奴/"
95
- "あu /合;(一致) 話が合う/会;人と会う/遭;(偶然、特によくないことにあう) 事故に遭う/逢;(人と|運命的にあう) 巡り逢う/遇;≒遭う/會;「会」の旧字/"
96
- "さく /策/柵/作/佐久;地名/朔;朔日 ⇔晦/槊;ほこ/搾;搾取/昨;昨夜/咋;(くう)/窄;狭窄/酢;酢酸/柞;いすのき/炸;炸裂/筰;山田耕筰/削;削除/索;検索/錯;錯誤/筴/縒;より/鑿/做;「作」の異体字/簀;す/嘖;さいな・む/捉;(漢音) とら・える/齪;齷齪/冊;(慣用音)竹冊/册;「冊」の旧字/辟;?/乍;?/"
97
- "さき /先/崎/左記/前/早紀/沙樹/早岐/沙貴/咲/埼/尖/嵜/碕/早記/"
98
- "いんにょう /飲尿/廴繞;[部首]/"
99
- "いんよう /引用/飲用/陰陽/"
100
- "かt /勝/買/飼/刈;(crop)草を刈る")
101
- "\n")))
102
- (sekka-jisyo-data
103
- '("watashiH Cわたしh" "watasiH Cわたしh" "wtshiH Cわたしh" "wtsiH Cわたしh" "wtxiH Cわたしh" "わたしh /私" "okonaU Cおこなu" "おこなu /行/行な;※送り位置補正" "hdkn Cへんかん" "hdkz Cへんかん" "henkan Cへんかん" "henkann Cへんかん" "henkaq Cへんかん" "hennkan Cへんかん" "hennkann Cへんかん" "hennkaq Cへんかん" "heqkan Cへんかん" "heqkann Cへんかん" "heqkaq Cへんかん" "へんかん /変換/返還" "hdka Cへんか" "henka Cへんか" "hennka Cへんか" "heqka Cへんか" "へんか /変化/返歌" "hdkaS Cへんかs" "henkaS Cへんかs" "hennkaS Cへんかs" "heqkaS Cへんかs" "へんかs /変化" "shizdgdgo Cしぜんげんご" "shizengengo Cしぜんげんご" "shizengenngo Cしぜんげんご" "shizengeqgo Cしぜんげんご" "shizenngengo Cしぜんげんご" "shizenngenngo Cしぜんげんご" "shizenngeqgo Cしぜんげんご" "shizeqgengo Cしぜんげんご" "shizeqgenngo Cしぜんげんご" "shizeqgeqgo Cしぜんげんご" "shizfngengo Cしぜんげんご" "shizfngenngo Cしぜんげんご" "shizfngeqgo Cしぜんげんご" "shizfnngengo Cしぜんげんご" "shizfnngenngo Cしぜんげんご" "shizfnngeqgo Cしぜんげんご" "shizfqgengo Cしぜんげんご" "shizfqgenngo Cしぜんげんご" "shizfqgeqgo Cしぜんげんご" "sizdgdgo Cしぜんげんご" "sizengengo Cしぜんげんご" "sizengenngo Cしぜんげんご" "sizengeqgo Cしぜんげんご" "sizenngengo Cしぜんげんご" "sizenngenngo Cしぜんげんご" "sizenngeqgo Cしぜんげんご" "sizeqgengo Cしぜんげんご" "sizeqgenngo Cしぜんげんご" "sizeqgeqgo Cしぜんげんご" "sizfngengo Cしぜんげんご" "sizfngenngo Cしぜんげんご" "sizfngeqgo Cしぜんげんご" "sizfnngengo Cしぜんげんご" "sizfnngenngo Cしぜんげんご" "sizfnngeqgo Cしぜんげんご" "sizfqgengo Cしぜんげんご" "sizfqgenngo Cしぜんげんご" "sizfqgeqgo Cしぜんげんご" "xizdgdgo Cしぜんげんご" "しぜんげんご /自然言語" "shizdgdgoshori Cしぜんげんごしょり" "shizdgdgosyori Cしぜんげんごしょり" "shizdgdgoxori Cしぜんげんごしょり" "shizengengoshori Cしぜんげんごしょり" "shizengengosyori Cしぜんげんごしょり" "shizengenngoshori Cしぜんげんごしょり" "shizengenngosyori Cしぜんげんごしょり" "shizengeqgoshori Cしぜんげんごしょり" "shizengeqgosyori Cしぜんげんごしょり" "shizenngengoshori Cしぜんげんごしょり" "shizenngengosyori Cしぜんげんごしょり" "shizenngenngoshori Cしぜんげんごしょり" "shizenngenngosyori Cしぜんげんごしょり" "shizenngeqgoshori Cしぜんげんごしょり" "shizenngeqgosyori Cしぜんげんごしょり" "shizeqgengoshori Cしぜんげんごしょり" "shizeqgengosyori Cしぜんげんごしょり" "shizeqgenngoshori Cしぜんげんごしょり" "shizeqgenngosyori Cしぜんげんごしょり" "shizeqgeqgoshori Cしぜんげんごしょり" "shizeqgeqgosyori Cしぜんげんごしょり" "shizfngengoshori Cしぜんげんごしょり" "shizfngengosyori Cしぜんげんごしょり" "shizfngenngoshori Cしぜんげんごしょり" "shizfngenngosyori Cしぜんげんごしょり" "shizfngeqgoshori Cしぜんげんごしょり" "shizfngeqgosyori Cしぜんげんごしょり" "shizfnngengoshori Cしぜんげんごしょり" "shizfnngengosyori Cしぜんげんごしょり" "shizfnngenngoshori Cしぜんげんごしょり" "shizfnngenngosyori Cしぜんげんごしょり" "shizfnngeqgoshori Cしぜんげんごしょり" "shizfnngeqgosyori Cしぜんげんごしょり" "shizfqgengoshori Cしぜんげんごしょり" "shizfqgengosyori Cしぜんげんごしょり" "shizfqgenngoshori Cしぜんげんごしょり" "shizfqgenngosyori Cしぜんげんごしょり" "shizfqgeqgoshori Cしぜんげんごしょり" "shizfqgeqgosyori Cしぜんげんごしょり" "sizdgdgoshori Cしぜんげんごしょり" "sizdgdgosyori Cしぜんげんごしょり" "sizdgdgoxori Cしぜんげんごしょり" "sizengengoshori Cしぜんげんごしょり" "sizengengosyori Cしぜんげんごしょり" "sizengenngoshori Cしぜんげんごしょり" "sizengenngosyori Cしぜんげんごしょり" "sizengeqgoshori Cしぜんげんごしょり" "sizengeqgosyori Cしぜんげんごしょり" "sizenngengoshori Cしぜんげんごしょり" "sizenngengosyori Cしぜんげんごしょり" "sizenngenngoshori Cしぜんげんごしょり" "sizenngenngosyori Cしぜんげんごしょり" "sizenngeqgoshori Cしぜんげんごしょり" "sizenngeqgosyori Cしぜんげんごしょり" "sizeqgengoshori Cしぜんげんごしょり" "sizeqgengosyori Cしぜんげんごしょり" "sizeqgenngoshori Cしぜんげんごしょり" "sizeqgenngosyori Cしぜんげんごしょり" "sizeqgeqgoshori Cしぜんげんごしょり" "sizeqgeqgosyori Cしぜんげんごしょり" "sizfngengoshori Cしぜんげんごしょり" "sizfngengosyori Cしぜんげんごしょり" "sizfngenngoshori Cしぜんげんごしょり" "sizfngenngosyori Cしぜんげんごしょり" "sizfngeqgoshori Cしぜんげんごしょり" "sizfngeqgosyori Cしぜんげんごしょり" "sizfnngengoshori Cしぜんげんごしょり" "sizfnngengosyori Cしぜんげんごしょり" "sizfnngenngoshori Cしぜんげんごしょり" "sizfnngenngosyori Cしぜんげんごしょり" "sizfnngeqgoshori Cしぜんげんごしょり" "sizfnngeqgosyori Cしぜんげんごしょり" "sizfqgengoshori Cしぜんげんごしょり" "sizfqgengosyori Cしぜんげんごしょり" "sizfqgenngoshori Cしぜんげんごしょり" "sizfqgenngosyori Cしぜんげんごしょり" "sizfqgeqgoshori Cしぜんげんごしょり" "sizfqgeqgosyori Cしぜんげんごしょり" "xizdgdgoshori Cしぜんげんごしょり" "xizdgdgosyori Cしぜんげんごしょり" "xizdgdgoxori Cしぜんげんごしょり" "しぜんげんごしょり /自然言語処理" "shizdgdgorikq Cしぜんげんごりかい" "shizengengorikai Cしぜんげんごりかい" "shizengenngorikai Cしぜんげんごりかい" "shizengeqgorikai Cしぜんげんごりかい" "shizenngengorikai Cしぜんげんごりかい" "shizenngenngorikai Cしぜんげんごりかい" "shizenngeqgorikai Cしぜんげんごりかい" "shizeqgengorikai Cしぜんげんごりかい" "shizeqgenngorikai Cしぜんげんごりかい" "shizeqgeqgorikai Cしぜんげんごりかい" "shizfngengorikai Cしぜんげんごりかい" "shizfngenngorikai Cしぜんげんごりかい" "shizfngeqgorikai Cしぜんげんごりかい" "shizfnngengorikai Cしぜんげんごりかい" "shizfnngenngorikai Cしぜんげんごりかい" "shizfnngeqgorikai Cしぜんげんごりかい" "shizfqgengorikai Cしぜんげんごりかい" "shizfqgenngorikai Cしぜんげんごりかい" "shizfqgeqgorikai Cしぜんげんごりかい" "sizdgdgorikq Cしぜんげんごりかい" "sizengengorikai Cしぜんげんごりかい" "sizengenngorikai Cしぜんげんごりかい" "sizengeqgorikai Cしぜんげんごりかい" "sizenngengorikai Cしぜんげんごりかい" "sizenngenngorikai Cしぜんげんごりかい" "sizenngeqgorikai Cしぜんげんごりかい" "sizeqgengorikai Cしぜんげんごりかい" "sizeqgenngorikai Cしぜんげんごりかい" "sizeqgeqgorikai Cしぜんげんごりかい" "sizfngengorikai Cしぜんげんごりかい" "sizfngenngorikai Cしぜんげんごりかい" "sizfngeqgorikai Cしぜんげんごりかい" "sizfnngengorikai Cしぜんげんごりかい" "sizfnngenngorikai Cしぜんげんごりかい" "sizfnngeqgorikai Cしぜんげんごりかい" "sizfqgengorikai Cしぜんげんごりかい" "sizfqgenngorikai Cしぜんげんごりかい" "sizfqgeqgorikai Cしぜんげんごりかい" "xizdgdgorikq Cしぜんげんごりかい" "しぜんげんごりかい /自然言語理解" "developer /デベロッパー/ディベロッパー/デベロッパ" ">an C>あん" ">ann C>あん" ">aq C>あん" ">あん /案" "{ /{" "ka;ko Cかっこ" "ka@ko Cかっこ" "kakko Cかっこ" "かっこ /確固/括弧/各個/各戸/確乎/羯鼓;雅楽の打楽器/格好/『』/【】/[]/〔〕/〈〉/《》/{}/「」/()/‘’/“”" "ko;ka Cこっか" "ko@ka Cこっか" "kokka Cこっか" "こっか /国家;state/国歌;anthem.「-斉唱」/国花/骨化/國家;「国」旧字/黒化/刻下/】/)/]/』" "! /!/感嘆符" ". /./・/。/…;..." "* /*/※/×" "? /?" "/ ///÷" "!= /≠" "ko'hi' Cこーひー" "ko'hi- Cこーひー" "ko'hi: Cこーひー" "ko'hi^ Cこーひー" "ko-hi' Cこーひー" "ko-hi- Cこーひー" "ko-hi: Cこーひー" "ko-hi^ Cこーひー" "ko:hi' Cこーひー" "ko:hi- Cこーひー" "ko:hi: Cこーひー" "ko:hi^ Cこーひー" "ko^hi' Cこーひー" "ko^hi- Cこーひー" "ko^hi: Cこーひー" "ko^hi^ Cこーひー" "こーひー /コーヒー" "kani Cかに" "かに /蟹/可児/蠏" "kani Cかんい" "kanni Cかんい" "kaqi Cかんい" "kni Cかんい" "kzi Cかんい" "かんい /簡易/官位/冠位;-十二階/漢医;漢方医/敢為/官医/寛衣/換位/簡意" "i;chi Cいっち" "i;ci Cいっち" "i;tyi Cいっち" "i@chi Cいっち" "i@ci Cいっち" "i@tyi Cいっち" "icchi Cいっち" "icci Cいっち" "ittyi Cいっち" "いっち /一致" "i;chi Cいっち" "i;ci Cいっち" "i;tyi Cいっち" "i@chi Cいっち" "i@ci Cいっち" "i@tyi Cいっち" "icchi Cいっち" "icci Cいっち" "ittyi Cいっち" "いっち /イッチ" "eR Cえr" "えr /得/獲;NB:「とr」と同形/選;NB:「よr」「すぐr」と同形" "wo Cを" "を /小/緒/雄/男/牡/尾/悪/汚/惡;「悪」の旧字(人名用漢字)" "miR Cみr" "みr /見/観;(字義:みわたす)/視;(字義:じっとみる)/診;(diagnose) 患者を診る/看;(nurse) 病母を看る/觀;「観」の旧字" "wake /ウェイク" "wake Cわけ" "わけ /訳/和気;地名/理由;当て字/分け/分/譯;「訳」の旧字/戯奴" "aU Cあu" "あu /合;(一致) 話が合う/会;人と会う/遭;(偶然、特によくないことにあう) 事故に遭う/逢;(人と|運命的にあう) 巡り逢う/遇;≒遭う/會;「会」の旧字" "saku Cさく" "さく /策/柵/作/佐久;地名/朔;朔日 ⇔晦/槊;ほこ/搾;搾取/昨;昨夜/咋;(くう)/窄;狭窄/酢;酢酸/柞;いすのき/炸;炸裂/筰;山田耕筰/削;削除/索;検索/錯;錯誤/筴/縒;より/鑿/做;「作」の異体字/簀;す/嘖;さいな・む/捉;(漢音) とら・える/齪;齷齪/冊;(慣用音)竹冊/册;「冊」の旧字/辟;?/乍;?" "sakf Cさき" "saki Cさき" "さき /先/崎/左記/前/早紀/沙樹/早岐/沙貴/咲/埼/尖/嵜/碕/早記" "inngp Cいんにょう" "innngp Cいんにょう" "innnyou Cいんにょう" "innnyowhu Cいんにょう" "innnyp Cいんにょう" "innyou Cいんにょう" "innyowhu Cいんにょう" "innyp Cいんにょう" "iqngp Cいんにょう" "iqnyou Cいんにょう" "iqnyowhu Cいんにょう" "iqnyp Cいんにょう" "いんにょう /飲尿/廴繞;[部首]" "innyou Cいんよう" "innyowhu Cいんよう" "innyp Cいんよう" "inyou Cいんよう" "inyowhu Cいんよう" "inyp Cいんよう" "iqyou Cいんよう" "iqyowhu Cいんよう" "iqyp Cいんよう" "いんよう /引用/飲用/陰陽" "kaT Cかt" "かt /勝/買/飼/刈;(crop)草を刈る" "ka` Cか`" "か` /勝/買/飼/刈;(crop)草を刈る" "ka+ Cか+" "か+ /勝/買/飼/刈;(crop)草を刈る")
104
- ))
105
-
106
- (test* "Create test jisyo"
107
- sekka-jisyo-data
108
- (convert-skk-jisyo-f _input))
109
-
110
- (test* "default KVS type" 'tokyocabinet (get-kvs-type))
111
-
112
- (set-kvs-type dbtype)
113
- (test* "changed KVS type" dbtype (get-kvs-type))
114
-
115
- (let1 sio (StringIO.new (string-join sekka-jisyo-data "\n"))
116
- (sio.set_encoding "utf-8")
117
- (load-sekka-jisyo-f sio target)))
63
+ (with-open "./test/skk-jisyo-in-1.txt"
64
+ (lambda (_input)
65
+ (let1 sekka-jisyo-data
66
+ (with-open "./test/sekka-jisyo-out-1.txt"
67
+ (lambda (f)
68
+ (read f)))
69
+
70
+ (test* "Create test jisyo"
71
+ sekka-jisyo-data
72
+ (convert-skk-jisyo-f _input))
73
+
74
+ (test* "default KVS type" 'tokyocabinet (get-kvs-type))
75
+
76
+ (set-kvs-type dbtype)
77
+ (test* "changed KVS type" dbtype (get-kvs-type))
78
+
79
+ (let1 sio (StringIO.new (string-join sekka-jisyo-data "\n"))
80
+ (sio.set_encoding "utf-8")
81
+ (load-sekka-jisyo-f sio target)))))
118
82
 
119
83
 
120
84
  ;;-------------------------------------------------------------------
121
- (when (eq? dbtype 'tokyocabinet)
122
- (require "digest/sha1")
123
- (test-section "dump db")
124
- (let1 _output (StringIO.new)
125
- (_output.set_encoding "utf-8")
126
- (test* "dump DB to SEKKA jisyo file. (1)"
127
- "442dac4a534cadcae60ccccbbae53752d6078e03"
128
- (begin
129
- (dump-sekka-jisyo-f _output target)
130
- (Digest::SHA1.hexdigest (_output.string))
131
- ;;(_output.string)
132
- ))))
133
-
134
-
85
+ (with-open "./test/sekka-dump-out-1.txt"
86
+ (lambda (f)
87
+ (let ((_input (f.read))
88
+ (_output (StringIO.new)))
89
+ (_output.set_encoding "utf-8")
90
+ (when (eq? dbtype 'tokyocabinet)
91
+ (test-section "dump db")
92
+ (test* "dump DB to SEKKA jisyo file. (1)"
93
+ _input
94
+ (begin
95
+ (dump-sekka-jisyo-f _output target)
96
+ (with-open "./test/sekka-dump-out-1.tmp"
97
+ (lambda (f) (f.write (_output.string)))
98
+ "w")
99
+ (_output.string)))))))
100
+
135
101
 
136
102
  (test-section "Open the test-suite DB")
137
103
  (define a-search (ApproximateSearch.new 0.94))
@@ -209,14 +175,18 @@
209
175
  (. (hash-table-get db "MASTER::(KA)" #f) force_encoding "UTF-8"))
210
176
 
211
177
  (test* "db fetch 8"
178
+ "#kaime #kara# #kqme #kr#"
179
+ (. (hash-table-get db "MASTER::(#k)" #f) force_encoding "UTF-8"))
180
+
181
+ (test* "db fetch 9"
212
182
  "burogu+ buroguR buroguT burogu`"
213
183
  (. (hash-table-get db "dummy::(BU)" #f) force_encoding "UTF-8"))
214
184
 
215
- (test* "db fetch 9"
185
+ (test* "db fetch 10"
216
186
  "/ユーザー辞書"
217
187
  (. (hash-table-get db "dummy::ゆーざーじしょ" #f) force_encoding "UTF-8"))
218
188
 
219
- (test* "db fetch 10"
189
+ (test* "db fetch 11"
220
190
  "yu'za'jisho yu'za'jisyo yu'za'jixo yu'za'zisho yu'za'zisyo yu'za'zixo yu'za-jisho yu'za-jisyo yu'za-jixo yu'za-zisho yu'za-zisyo yu'za-zixo yu'za:jisho yu'za:jisyo yu'za:jixo yu'za:zisho yu'za:zisyo yu'za:zixo yu'za^jisho yu'za^jisyo yu'za^jixo yu'za^zisho yu'za^zisyo yu'za^zixo yu'zc'jisho yu'zc'jisyo yu'zc'jixo yu'zc'zisho yu'zc'zisyo yu'zc'zixo yu'zc-jisho yu'zc-jisyo yu'zc-jixo yu'zc-zisho yu'zc-zisyo yu'zc-zixo yu'zc:jisho yu'zc:jisyo yu'zc:jixo yu'zc:zisho yu'zc:zisyo yu'zc:zixo yu'zc^jisho yu'zc^jisyo yu'zc^jixo yu'zc^zisho yu'zc^zisyo yu'zc^zixo yu-za'jisho yu-za'jisyo yu-za'jixo yu-za'zisho yu-za'zisyo yu-za'zixo yu-za-jisho yu-za-jisyo yu-za-jixo yu-za-zisho yu-za-zisyo yu-za-zixo yu-za:jisho yu-za:jisyo yu-za:jixo yu-za:zisho yu-za:zisyo yu-za:zixo yu-za^jisho yu-za^jisyo yu-za^jixo yu-za^zisho yu-za^zisyo yu-za^zixo yu-zc'jisho yu-zc'jisyo yu-zc'jixo yu-zc'zisho yu-zc'zisyo yu-zc'zixo yu-zc-jisho yu-zc-jisyo yu-zc-jixo yu-zc-zisho yu-zc-zisyo yu-zc-zixo yu-zc:jisho yu-zc:jisyo yu-zc:jixo yu-zc:zisho yu-zc:zisyo yu-zc:zixo yu-zc^jisho yu-zc^jisyo yu-zc^jixo yu-zc^zisho yu-zc^zisyo yu-zc^zixo yu:za'jisho yu:za'jisyo yu:za'jixo yu:za'zisho yu:za'zisyo yu:za'zixo yu:za-jisho yu:za-jisyo yu:za-jixo yu:za-zisho yu:za-zisyo yu:za-zixo yu:za:jisho yu:za:jisyo yu:za:jixo yu:za:zisho yu:za:zisyo yu:za:zixo yu:za^jisho yu:za^jisyo yu:za^jixo yu:za^zisho yu:za^zisyo yu:za^zixo yu:zc'jisho yu:zc'jisyo yu:zc'jixo yu:zc'zisho yu:zc'zisyo yu:zc'zixo yu:zc-jisho yu:zc-jisyo yu:zc-jixo yu:zc-zisho yu:zc-zisyo yu:zc-zixo yu:zc:jisho yu:zc:jisyo yu:zc:jixo yu:zc:zisho yu:zc:zisyo yu:zc:zixo yu:zc^jisho yu:zc^jisyo yu:zc^jixo yu:zc^zisho yu:zc^zisyo yu:zc^zixo yu^za'jisho yu^za'jisyo yu^za'jixo yu^za'zisho yu^za'zisyo yu^za'zixo yu^za-jisho yu^za-jisyo yu^za-jixo yu^za-zisho yu^za-zisyo yu^za-zixo yu^za:jisho yu^za:jisyo yu^za:jixo yu^za:zisho yu^za:zisyo yu^za:zixo yu^za^jisho yu^za^jisyo yu^za^jixo yu^za^zisho yu^za^zisyo yu^za^zixo yu^zc'jisho yu^zc'jisyo yu^zc'jixo yu^zc'zisho yu^zc'zisyo yu^zc'zixo yu^zc-jisho yu^zc-jisyo yu^zc-jixo yu^zc-zisho yu^zc-zisyo yu^zc-zixo yu^zc:jisho yu^zc:jisyo yu^zc:jixo yu^zc:zisho yu^zc:zisyo yu^zc:zixo yu^zc^jisho yu^zc^jisyo yu^zc^jixo yu^zc^zisho yu^zc^zisyo yu^zc^zixo"
221
191
  (. (hash-table-get db "dummy::(yu)" #f) force_encoding "UTF-8"))
222
192
 
@@ -359,6 +329,16 @@
359
329
  (my-round-map
360
330
  (approximate-search userid kvs "innyou" #f 0)))
361
331
 
332
+ (test* "approximate search 11"
333
+ '((0.981 "#gyoume" "C#ぎょうめ"))
334
+ (my-round-map
335
+ (approximate-search userid kvs "#gyoum" #f 0)))
336
+
337
+ (test* "approximate search 12"
338
+ '((0.9722 "#kara#" "C#から#"))
339
+ (my-round-map
340
+ (approximate-search userid kvs "#kara" #f 0)))
341
+
362
342
 
363
343
  ;;-------------------------------------------------------------------
364
344
  (test-section "henkan (okuri nashi)")
@@ -455,6 +435,61 @@
455
435
  '(("ユーザー辞書" #f "ゆーざーじしょ" j))
456
436
  (henkan-okuri-nashi userid kvs "Yu'za'jisyo" 0))
457
437
 
438
+ ;;-------------------------------------------------------------------
439
+ (test-section "henkan (okuri nashi and number)")
440
+
441
+ (test* "okuri nashi and number 1"
442
+ '(("2行目" #f "#ぎょうめ" n) ("2行目" #f "#ぎょうめ" n))
443
+ (henkan-okuri-nashi-and-number userid kvs "2gyoume" 0))
444
+
445
+ (test* "okuri nashi and number 2"
446
+ '(("10行目" #f "#ぎょうめ" n) ("10行目" #f "#ぎょうめ" n))
447
+ (henkan-okuri-nashi-and-number userid kvs "10gyoume" 0))
448
+
449
+ (test* "okuri nashi and number 3"
450
+ '(("100回目" #f "#かいめ" n) ("百回目" #f "#かいめ" n))
451
+ (henkan-okuri-nashi-and-number userid kvs "100kaime" 0))
452
+
453
+ (test* "okuri nashi and number 4"
454
+ '(("3月3日" #f "#がつ#か" n) ("3月3日" #f "#がつ#か" n) ("三月三日" #f "#がつ#か" n) ("三月3日" #f "#がつ#か" n))
455
+ (henkan-okuri-nashi-and-number userid kvs "3gatu3ka" 0))
456
+
457
+ (test* "okuri nashi and number 5"
458
+ '(("12月31日" #f "#がつ#にち" n) ("12月31日" #f "#がつ#にち" n) ("一二月三一日" #f "#がつ#にち" n) ("一二月31日" #f "#がつ#にち" n))
459
+ (henkan-okuri-nashi-and-number userid kvs "12gatu31nichi" 0))
460
+
461
+ (test* "okuri nashi and number 6"
462
+ '(("1〜10" #f "#から#" n))
463
+ (henkan-okuri-nashi-and-number userid kvs "1kara10" 0))
464
+
465
+ (test* "okuri nashi and number 7"
466
+ '(("1000〜2000" #f "#から#" n))
467
+ (henkan-okuri-nashi-and-number userid kvs "1000kara2000" 0))
468
+
469
+
470
+ ;;-------------------------------------------------------------------
471
+ (test-section "henkan (number)")
472
+
473
+ (test* "number 1"
474
+ '(("1" nil "1" n) ("1" nil "1" n) ("一" nil "1" n) ("一" nil "1" n))
475
+ (henkan-number kvs "1"))
476
+
477
+ (test* "number 2"
478
+ '(("10" nil "10" n) ("10" nil "10" n) ("一〇" nil "10" n) ("十" nil "10" n))
479
+ (henkan-number kvs "10"))
480
+
481
+ (test* "number 3"
482
+ '(("100" nil "100" n) ("100" nil "100" n) ("一〇〇" nil "100" n) ("百" nil "100" n))
483
+ (henkan-number kvs "100"))
484
+
485
+ (test* "number 4"
486
+ '(("1234567890" nil "1234567890" n) ("1234567890" nil "1234567890" n) ("一二三四五六七八九〇" nil "1234567890" n) ("十二億三千四百五十六万七千八百九十" nil "1234567890" n))
487
+ (henkan-number kvs "1234567890"))
488
+
489
+ (test* "number 5"
490
+ '(("1234567890" nil "1234567890" n) ("1234567890" nil "1234567890" n) ("一二三四五六七八九〇" nil "1234567890" n) ("十二億三千四百五十六万七千八百九十" nil "1234567890" n))
491
+ (henkan-number kvs "1234567890"))
492
+
458
493
 
459
494
  ;;-------------------------------------------------------------------
460
495
  (test-section "henkan (okuri ari)")
@@ -801,6 +836,10 @@
801
836
  '(("確固" #f "かっこ" j 0) ("かっこ" #f "ka;ko" h 1) ("カッコ" #f "ka;ko" k 2) ("Ka;ko" #f "Ka;ko" z 3) ("Ka;ko" #f "Ka;ko" l 4))
802
837
  (sekka-henkan userid kvs "Ka;ko" 1 :normal))
803
838
 
839
+ (test* "henkan toplevel 30"
840
+ '(("100回目" #f "#かいめ" n 0) ("百回目" #f "#かいめ" n 1) ("100kaime" #f "100kaime" z 2) ("100kaime" #f "100kaime" l 3))
841
+ (sekka-henkan userid kvs "100kaime" 0 :normal))
842
+
804
843
 
805
844
 
806
845
  (test* "henkan toplevel(for Elisp) 1"
@@ -871,6 +910,21 @@
871
910
  '(("ユーザー辞書" nil "ゆーざーじしょ" j 0) ("ゆーざーじしょ" nil "yu-za-jisyo" h 1) ("ユーザージショ" nil "yu-za-jisyo" k 2) ("Yu-za-jisyo" nil "Yu-za-jisyo" z 3) ("Yu-za-jisyo" nil "Yu-za-jisyo" l 4))
872
911
  (sekkaHenkan userid kvs #f "Yu-za-jisyo" 2 "normal"))
873
912
 
913
+ (test* "henkan toplevel(for Elisp) 18"
914
+ '(("2月28日" nil "#がつ#にち" n 0) ("2月28日" nil "#がつ#にち" n 1) ("二月二八日" nil "#がつ#にち" n 2) ("二月28日" nil "#がつ#にち" n 3) ("2gatu28nichi" nil "2gatu28nichi" z 4) ("2gatu28nichi" nil "2gatu28nichi" l 5))
915
+ (sekkaHenkan userid kvs #f "2gatu28nichi" 0 "normal"))
916
+
917
+ (test* "henkan toplevel(for Elisp) 19"
918
+ '(("100" nil "100" n 0) ("100" nil "100" n 1) ("一〇〇" nil "100" n 2) ("百" nil "100" n 3))
919
+ (sekkaHenkan userid kvs #f "100" 0 "normal"))
920
+
921
+ (test* "henkan toplevel(for Elisp) 20"
922
+ '(("1000020003" nil "1000020003" n 0) ("1000020003" nil "1000020003" n 1) ("一〇〇〇〇二〇〇〇三" nil "1000020003" n 2) ("十億二万三" nil "1000020003" n 3))
923
+ (sekkaHenkan userid kvs #f "1000020003" 0 "normal"))
924
+ (test* "henkan toplevel(for Elisp) 21"
925
+ '(("3チーム" nil "#ちーむ" n 0) ("3chi-mu" nil "3chi-mu" z 1) ("3chi-mu" nil "3chi-mu" l 2))
926
+ (sekkaHenkan userid kvs #f "3chi-mu" 0 "normal"))
927
+
874
928
 
875
929
  ;;-------------------------------------------------------------------
876
930
  (test-section "henkan kakutei")
data/test/jisyo.nnd CHANGED
@@ -63,6 +63,18 @@
63
63
  (test* "expanding SKK(1) entry to SEKKA(n) entry. (送りあり1)"
64
64
  '(("shiroI" . "Cしろi") ("siroI" . "Cしろi") ("xiroI" . "Cしろi") ("しろi" . "/白"))
65
65
  (expand-okuri-ari-entry "しろ" "i" "/白"))
66
+ (test* "expanding SKK(1) entry to SEKKA(n) entry. (#付き1)"
67
+ '(("#ji" . "C#じ") ("#zi" . "C#じ") ("#じ" . "/#0時/#1時/#2時/#0次/#3次/#1次/"))
68
+ (expand-okuri-nashi-entry "#じ" "/#0時/#1時/#2時/#0次/#3次/#1次/"))
69
+ (test* "expanding SKK(1) entry to SEKKA(n) entry. (#付き2)"
70
+ '(("#gatsu#nichi" . "C#がつ#にち") ("#gatsu#nici" . "C#がつ#にち") ("#gatsu#niti" . "C#がつ#にち") ("#gatsu#nityi" . "C#がつ#にち") ("#gatsu#nt" . "C#がつ#にち") ("#gatu#nichi" . "C#がつ#にち") ("#gatu#nici" . "C#がつ#にち") ("#gatu#niti" . "C#がつ#にち") ("#gatu#nityi" . "C#がつ#にち") ("#gatu#nt" . "C#がつ#にち") ("#がつ#にち" . "/#1月#1日/#0月#0日/#2月#2日/#2月#1日/"))
71
+ (expand-okuri-nashi-entry "#がつ#にち" "/#1月#1日/#0月#0日/#2月#2日/#2月#1日/"))
72
+ (test* "expanding SKK(1) entry to SEKKA(n) entry. (#付き3)"
73
+ '(("#kara#" . "C#から#") ("#kr#" . "C#から#") ("#から#" . "/#1〜#1/"))
74
+ (expand-okuri-nashi-entry "#から#" "/#1〜#1/"))
75
+ (test* "expanding SKK(1) entry to SEKKA(n) entry. (#付き4)"
76
+ '(("#chi'mf" . "C#ちーむ") ("#chi'mu" . "C#ちーむ") ("#chi-mf" . "C#ちーむ") ("#chi-mu" . "C#ちーむ") ("#chi:mf" . "C#ちーむ") ("#chi:mu" . "C#ちーむ") ("#chi^mf" . "C#ちーむ") ("#chi^mu" . "C#ちーむ") ("#ci'mf" . "C#ちーむ") ("#ci'mu" . "C#ちーむ") ("#ci-mf" . "C#ちーむ") ("#ci-mu" . "C#ちーむ") ("#ci:mf" . "C#ちーむ") ("#ci:mu" . "C#ちーむ") ("#ci^mf" . "C#ちーむ") ("#ci^mu" . "C#ちーむ") ("#ti'mf" . "C#ちーむ") ("#ti'mu" . "C#ちーむ") ("#ti-mf" . "C#ちーむ") ("#ti-mu" . "C#ちーむ") ("#ti:mf" . "C#ちーむ") ("#ti:mu" . "C#ちーむ") ("#ti^mf" . "C#ちーむ") ("#ti^mu" . "C#ちーむ") ("#tyi'mf" . "C#ちーむ") ("#tyi'mu" . "C#ちーむ") ("#tyi-mf" . "C#ちーむ") ("#tyi-mu" . "C#ちーむ") ("#tyi:mf" . "C#ちーむ") ("#tyi:mu" . "C#ちーむ") ("#tyi^mf" . "C#ちーむ") ("#tyi^mu" . "C#ちーむ") ("#ちーむ" . "/#0チーム/"))
77
+ (expand-okuri-nashi-entry "#ちーむ" "/#0チーム/"))
66
78
  (test* "expanding SKK(1) entry to SEKKA(n) entry. (送りあり2)"
67
79
  '(("kaK" . "Cかk") ("かk" . "/書/掛/欠/架/駆/懸"))
68
80
  (expand-okuri-ari-entry "か" "k" "/書/掛/欠/架/駆/懸"))
data/test/roman-lib.nnd CHANGED
@@ -79,6 +79,9 @@
79
79
  (test* "kana->roman 5"
80
80
  '("-" "^" ":" "'")
81
81
  (hash-table-get sekka-kana->roman-hash-short "ー" #f))
82
+ (test* "kana->roman 6"
83
+ '("#")
84
+ (hash-table-get sekka-kana->roman-hash-short "#" #f))
82
85
 
83
86
  ;;-------------------------------------------------------------------
84
87
  (test-section "kana->roman conversion hash (long)")
@@ -129,6 +132,9 @@
129
132
  (test* "roman->kana 11"
130
133
  '("ぁ")
131
134
  (hash-table-get sekka-roman->kana-hash-short "xxa" #f))
135
+ (test* "roman->kana 12"
136
+ '("#")
137
+ (hash-table-get sekka-roman->kana-hash-short "#" #f))
132
138
 
133
139
  ;;-------------------------------------------------------------------
134
140
  (test-section "roman->kana conversion hash (long)")
@@ -268,8 +274,8 @@
268
274
 
269
275
  (let1 hira-list
270
276
  (hash-table-keys sekka-kana->roman-hash-long)
271
- (test* "kana->roman table length" 523 (length hira-list))
272
- (test* "kana->roman key duplicate check" 523 (length (uniq (sort hira-list)))))
277
+ (test* "kana->roman table length" 524 (length hira-list))
278
+ (test* "kana->roman key duplicate check" 524 (length (uniq (sort hira-list)))))
273
279
 
274
280
  (test* "hiragana -> roman-pattern0"
275
281
  '(
@@ -332,6 +338,14 @@
332
338
  '("tsumikf" "tsumiki" "tumikf" "tumiki")
333
339
  (gen-hiragana->roman-list "つみき"))
334
340
 
341
+ (test* "hiragana -> roman-list6"
342
+ '("gyoume" "gyowhume" "gypme")
343
+ (gen-hiragana->roman-list "ぎょうめ"))
344
+
345
+ (test* "hiragana -> roman-list7"
346
+ '("#gyoume" "#gyowhume" "#gypme")
347
+ (gen-hiragana->roman-list "#ぎょうめ"))
348
+
335
349
 
336
350
  ;;-------------------------------------------------------------------
337
351
  (test-section "roman->kana conversion functions")
@@ -0,0 +1,206 @@
1
+ ;;-*- mode: nendo; syntax: scheme -*-
2
+ ;;;
3
+ ;;; sharp-number.nnd - 数字を漢数字等に変換するライブラリのテストスイート
4
+ ;;;
5
+ ;;; Copyright (c) 2010 Kiyoka Nishiyama <kiyoka@sumibi.org>
6
+ ;;;
7
+ ;;; Redistribution and use in source and binary forms, with or without
8
+ ;;; modification, are permitted provided that the following conditions
9
+ ;;; are met:
10
+ ;;;
11
+ ;;; 1. Redistributions of source code must retain the above copyright
12
+ ;;; notice, this list of conditions and the following disclaimer.
13
+ ;;;
14
+ ;;; 2. Redistributions in binary form must reproduce the above copyright
15
+ ;;; notice, this list of conditions and the following disclaimer in the
16
+ ;;; documentation and/or other materials provided with the distribution.
17
+ ;;;
18
+ ;;; 3. Neither the name of the authors nor the names of its contributors
19
+ ;;; may be used to endorse or promote products derived from this
20
+ ;;; software without specific prior written permission.
21
+ ;;;
22
+ ;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23
+ ;;; "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24
+ ;;; LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25
+ ;;; A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26
+ ;;; OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27
+ ;;; SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
28
+ ;;; TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
29
+ ;;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30
+ ;;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31
+ ;;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32
+ ;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
+ ;;;
34
+ ;;; $Id:
35
+ ;;;
36
+ (use nendo.test)
37
+ (use sekka.sharp-number)
38
+ (test-start "sharp-number")
39
+
40
+ ;;===================================================================
41
+
42
+ ;;-------------------------------------------------------------------
43
+ (test-section "type #0")
44
+ (test* "type #0 (1)"
45
+ "1"
46
+ (sekka-henkan-sharp-number "#0" "1"))
47
+
48
+ (test* "type #0 (2)"
49
+ "0123456789"
50
+ (sekka-henkan-sharp-number "#0" "0123456789"))
51
+
52
+ (test* "type #0 (3)"
53
+ "01234567890123456789"
54
+ (sekka-henkan-sharp-number "#0" "01234567890123456789"))
55
+
56
+
57
+ ;;-------------------------------------------------------------------
58
+ (test-section "type #1")
59
+ (test* "type #1 (1)"
60
+ "1"
61
+ (sekka-henkan-sharp-number "#1" "1"))
62
+
63
+ (test* "type #1 (2)"
64
+ "0123456789"
65
+ (sekka-henkan-sharp-number "#1" "0123456789"))
66
+
67
+ (test* "type #1 (3)"
68
+ "01234567890123456789"
69
+ (sekka-henkan-sharp-number "#1" "01234567890123456789"))
70
+
71
+
72
+ ;;-------------------------------------------------------------------
73
+ (test-section "type #2")
74
+ (test* "type #2 (1)"
75
+ "一"
76
+ (sekka-henkan-sharp-number "#2" "1"))
77
+
78
+ (test* "type #2 (2)"
79
+ "五五〇〇"
80
+ (sekka-henkan-sharp-number "#2" "5500"))
81
+
82
+ (test* "type #2 (3)"
83
+ "〇一二三四五六七八九"
84
+ (sekka-henkan-sharp-number "#2" "0123456789"))
85
+
86
+
87
+ ;;-------------------------------------------------------------------
88
+ (test-section "kansuuji henkan sen")
89
+ (test* "kansuuji sen (1)"
90
+ "一"
91
+ (sekka-henkan-kansuuji-sen "1"))
92
+
93
+ (test* "kansuuji sen (2)"
94
+ "十"
95
+ (sekka-henkan-kansuuji-sen "10"))
96
+
97
+ (test* "kansuuji sen (3)"
98
+ "百"
99
+ (sekka-henkan-kansuuji-sen "100"))
100
+
101
+ (test* "kansuuji sen (4)"
102
+ "千"
103
+ (sekka-henkan-kansuuji-sen "1000"))
104
+
105
+ (test* "kansuuji sen (5)"
106
+ "五千五百"
107
+ (sekka-henkan-kansuuji-sen "5500"))
108
+
109
+ (test* "kansuuji sen (6)"
110
+ "五千五百五十五"
111
+ (sekka-henkan-kansuuji-sen "5555"))
112
+
113
+ (test* "kansuuji sen (7)"
114
+ "九千九百九十九"
115
+ (sekka-henkan-kansuuji-sen "9999"))
116
+
117
+
118
+ ;;-------------------------------------------------------------------
119
+ (test-section "kansuuji henkan")
120
+
121
+ (test* "kansuuji (1)"
122
+ "一"
123
+ (sekka-henkan-kansuuji "1"))
124
+
125
+ (test* "kansuuji (2)"
126
+ "十"
127
+ (sekka-henkan-kansuuji "10"))
128
+
129
+ (test* "kansuuji (3)"
130
+ "百"
131
+ (sekka-henkan-kansuuji "100"))
132
+
133
+ (test* "kansuuji (4)"
134
+ "千"
135
+ (sekka-henkan-kansuuji "1000"))
136
+
137
+ (test* "kansuuji (5)"
138
+ "五千五百"
139
+ (sekka-henkan-kansuuji "5500"))
140
+
141
+ (test* "kansuuji (6)"
142
+ "五千五百五十五"
143
+ (sekka-henkan-kansuuji "5555"))
144
+
145
+ (test* "kansuuji (7)"
146
+ "九千九百九十九"
147
+ (sekka-henkan-kansuuji "9999"))
148
+
149
+ (test* "kansuuji (8)"
150
+ "一万"
151
+ (sekka-henkan-kansuuji "10000"))
152
+
153
+ (test* "kansuuji (9)"
154
+ "一億"
155
+ (sekka-henkan-kansuuji "100000000"))
156
+
157
+ (test* "kansuuji (10)"
158
+ "十億"
159
+ (sekka-henkan-kansuuji "1000000000"))
160
+
161
+ (test* "kansuuji (11)"
162
+ "一兆"
163
+ (sekka-henkan-kansuuji "1000000000000"))
164
+
165
+ (test* "kansuuji (12)"
166
+ "一兆二"
167
+ (sekka-henkan-kansuuji "1000000000002"))
168
+
169
+ (test* "kansuuji (13)"
170
+ "一億二千三百四十五万六千七百八十九"
171
+ (sekka-henkan-kansuuji "0123456789"))
172
+
173
+ (test* "kansuuji (14)"
174
+ "九千八百七十六京五千四百三十二兆千九十八億七千六百五十四万三千二百十"
175
+ (sekka-henkan-kansuuji "98765432109876543210"))
176
+
177
+
178
+ ;;-------------------------------------------------------------------
179
+ (test-section "type #3")
180
+ (test* "type #3 (1)"
181
+ "一"
182
+ (sekka-henkan-sharp-number "#3" "1"))
183
+
184
+ (test* "type #3 (2)"
185
+ "十"
186
+ (sekka-henkan-sharp-number "#3" "10"))
187
+
188
+ (test* "type #3 (3)"
189
+ "百"
190
+ (sekka-henkan-sharp-number "#3" "100"))
191
+
192
+ (test* "type #3 (4)"
193
+ "五千五百"
194
+ (sekka-henkan-sharp-number "#3" "5500"))
195
+
196
+ (test* "type #3 (5)"
197
+ "五万五千五百五十五"
198
+ (sekka-henkan-sharp-number "#3" "55555"))
199
+
200
+ (test* "type #3 (6)"
201
+ "一億二千三百四十五万六千七百八十九"
202
+ (sekka-henkan-sharp-number "#3" "0123456789"))
203
+
204
+
205
+ ;;===================================================================
206
+ (test-end)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 8
8
- - 4
9
- version: 0.8.4
8
+ - 5
9
+ version: 0.8.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kiyoka Nishiyama
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-02-24 00:00:00 +09:00
17
+ date: 2011-03-10 00:00:00 +09:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -155,6 +155,7 @@ files:
155
155
  - lib/sekka/kvs.rb
156
156
  - lib/sekka/roman-lib.nnd
157
157
  - lib/sekka/sekkaversion.rb
158
+ - lib/sekka/sharp-number.nnd
158
159
  - lib/sekka/util.nnd
159
160
  - lib/sekkaconfig.rb
160
161
  - lib/sekkaserver.rb
@@ -167,6 +168,7 @@ files:
167
168
  - test/henkan-main.nnd
168
169
  - test/jisyo.nnd
169
170
  - test/roman-lib.nnd
171
+ - test/sharp-number.nnd
170
172
  - test/skk-azik-table.nnd
171
173
  - test/util.nnd
172
174
  has_rdoc: true