diff options
| -rw-r--r-- | ChangeLog | 2 | ||||
| -rw-r--r-- | leim/ChangeLog | 2 | ||||
| -rw-r--r-- | leim/ja-dic/ja-dic.el | 10 | ||||
| -rw-r--r-- | leim/ja-dic/ja-dic.elc | bin | 0 -> 1507471 bytes | |||
| -rw-r--r-- | lisp/ChangeLog | 19 | ||||
| -rw-r--r-- | lisp/international/skkdic-cnv.el | 560 | ||||
| -rw-r--r-- | lisp/international/skkdic-utl.el | 214 |
7 files changed, 26 insertions, 781 deletions
| @@ -1,6 +1,6 @@ | |||
| 1 | 2000-08-25 Kenichi Handa <handa@etl.go.jp> | 1 | 2000-08-25 Kenichi Handa <handa@etl.go.jp> |
| 2 | 2 | ||
| 3 | * leim-Makefile.in: Rename skkdic to ja-dic through out the file. | 3 | * leim-Makefile.in: Rename skkdic to ja-dic throughout the file. |
| 4 | 4 | ||
| 5 | 2000-08-24 Gerd Moellmann <gerd@gnu.org> | 5 | 2000-08-24 Gerd Moellmann <gerd@gnu.org> |
| 6 | 6 | ||
diff --git a/leim/ChangeLog b/leim/ChangeLog index bc29bffd8a0..48a98126187 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | * ja-dic: Directory name changed from skkdic. | 3 | * ja-dic: Directory name changed from skkdic. |
| 4 | 4 | ||
| 5 | * ja-dic/ja-dic.el[c]: Renamed from skkdic.el[c]. | 5 | * ja-dic/ja-dic.el[c]: Re-generated by the new ja-dic-cnv.el. |
| 6 | 6 | ||
| 7 | * README: Rename skkdic to ja-dic throughout the file. | 7 | * README: Rename skkdic to ja-dic throughout the file. |
| 8 | 8 | ||
diff --git a/leim/ja-dic/ja-dic.el b/leim/ja-dic/ja-dic.el index e98c0f405fe..c36e5e523b3 100644 --- a/leim/ja-dic/ja-dic.el +++ b/leim/ja-dic/ja-dic.el | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | ;; skkdic.el -- dictionary for Japanese input method | 1 | ;; ja-dic.el -- dictionary for Japanese input method |
| 2 | ;; Generated by the command `skkdic-convert' | 2 | ;; Generated by the command `skkdic-convert' |
| 3 | ;; Date: Fri Aug 25 09:40:31 2000 | 3 | ;; Date: Fri Aug 25 11:06:13 2000 |
| 4 | ;; Original SKK dictionary file: SKK-JISYO.L | 4 | ;; Original SKK dictionary file: SKK-JISYO.L |
| 5 | 5 | ||
| 6 | ;;; Comment: | 6 | ;;; Comment: |
| @@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | ;;; Code: | 39 | ;;; Code: |
| 40 | 40 | ||
| 41 | (eval-when-compile (require 'skkdic-cnv)) | 41 | (eval-when-compile (require 'ja-dic-cnv)) |
| 42 | 42 | ||
| 43 | ;; Setting okuri-ari entries. | 43 | ;; Setting okuri-ari entries. |
| 44 | (skkdic-set-okuri-ari | 44 | (skkdic-set-okuri-ari |
| @@ -54597,6 +54597,6 @@ | |||
| 54597 | ) | 54597 | ) |
| 54598 | 54598 | ||
| 54599 | ;; | 54599 | ;; |
| 54600 | (provide 'skkdic) | 54600 | (provide 'ja-dic) |
| 54601 | 54601 | ||
| 54602 | ;; skkdic.el ends here | 54602 | ;; ja-dic.el ends here |
diff --git a/leim/ja-dic/ja-dic.elc b/leim/ja-dic/ja-dic.elc new file mode 100644 index 00000000000..8e59ef813bf --- /dev/null +++ b/leim/ja-dic/ja-dic.elc | |||
| Binary files differ | |||
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 368783ff286..2cad7f23282 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,22 @@ | |||
| 1 | 2000-08-25 Kenichi Handa <handa@etl.go.jp> | ||
| 2 | |||
| 3 | * international/kkc.el: Remove SKK from Keywords. Require | ||
| 4 | ja-dic-utl instead of skkdic-utl. | ||
| 5 | |||
| 6 | * international/ja-dic-cnv.el: Renamed from skkdic-cnv.el. | ||
| 7 | Provide ja-dic-cnv instead of skkdic-cnv. | ||
| 8 | (ja-dic-filename): Renamed from skkdic-filename. Referers changed | ||
| 9 | (iso-2022-7bit-short): Add safe-charsets property. | ||
| 10 | (skkdic-convert-postfix): Search Japanese chou-on character in | ||
| 11 | addition to Hiragana character. | ||
| 12 | (skkdic-convert-prefix, skkdic-collect-okuri-nasi): Likewise. | ||
| 13 | (skkdic-convert): Change file names from skkdic.el to ja-dic.el | ||
| 14 | (batch-skkdic-convert): Likewise. | ||
| 15 | |||
| 16 | * international/ja-dic-utl.el: Renamed from skkdic-utl.el. | ||
| 17 | Provide ja-dic-utl instead of skkdic-utl. | ||
| 18 | (skkdic-lookup-key): Load ja-dic/ja-dic, not skkdic/skkdic. | ||
| 19 | |||
| 1 | 2000-08-24 Dave Love <fx@gnu.org> | 20 | 2000-08-24 Dave Love <fx@gnu.org> |
| 2 | 21 | ||
| 3 | * disp-table.el (standard-display-default): Make the test of `l' | 22 | * disp-table.el (standard-display-default): Make the test of `l' |
diff --git a/lisp/international/skkdic-cnv.el b/lisp/international/skkdic-cnv.el deleted file mode 100644 index 186cc8bfb48..00000000000 --- a/lisp/international/skkdic-cnv.el +++ /dev/null | |||
| @@ -1,560 +0,0 @@ | |||
| 1 | ;;; skkdic-cnv.el --- Convert a SKK dictionary for `skkdic-utl' | ||
| 2 | |||
| 3 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | ||
| 4 | ;; Licensed to the Free Software Foundation. | ||
| 5 | |||
| 6 | ;; Keywords: mule, multilingual, Japanese, SKK | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; SKK is a Japanese input method running on Mule created by Masahiko | ||
| 28 | ;; Sato <masahiko@sato.riec.tohoku.ac.jp>. Here we provide utilities | ||
| 29 | ;; to handle a dictionary distributed with SKK so that a different | ||
| 30 | ;; input method (e.g. quail-japanese) can utilize the dictionary. | ||
| 31 | |||
| 32 | ;; The format of SKK dictionary is quite simple. Each line has the | ||
| 33 | ;; form "KANASTRING /CONV1/CONV2/.../" which means KANASTRING ($B2>L>J8(B | ||
| 34 | ;; $B;zNs(B) can be converted to one of CONVi. CONVi is a Kanji ($B4A;z(B) | ||
| 35 | ;; and Kana ($B2>L>(B) mixed string. | ||
| 36 | ;; | ||
| 37 | ;; KANASTRING may have a trailing ASCII letter for Okurigana ($BAw$j2>L>(B) | ||
| 38 | ;; information. For instance, the trailing letter `k' means that one | ||
| 39 | ;; of the following Okurigana is allowed: $B$+$-$/$1$3(B. So, in that | ||
| 40 | ;; case, the string "KANASTRING$B$/(B" can be converted to one of "CONV1$B$/(B", | ||
| 41 | ;; CONV2$B$/(B, ... | ||
| 42 | |||
| 43 | ;;; Code: | ||
| 44 | |||
| 45 | ;; Name of a file to generate from SKK dictionary. | ||
| 46 | (defvar skkdic-filename "skkdic.el") | ||
| 47 | |||
| 48 | ;; To make a generated skkdic.el smaller. | ||
| 49 | (make-coding-system | ||
| 50 | 'iso-2022-7bit-short | ||
| 51 | 2 ?J | ||
| 52 | "Like `iso-2022-7bit' but no ASCII designation before SPC." | ||
| 53 | '(ascii nil nil nil t t nil t)) | ||
| 54 | |||
| 55 | (defun skkdic-convert-okuri-ari (skkbuf buf) | ||
| 56 | (message "Processing OKURI-ARI entries ...") | ||
| 57 | (goto-char (point-min)) | ||
| 58 | (save-excursion | ||
| 59 | (set-buffer buf) | ||
| 60 | (insert ";; Setting okuri-ari entries.\n" | ||
| 61 | "(skkdic-set-okuri-ari\n")) | ||
| 62 | (while (not (eobp)) | ||
| 63 | (let ((from (point)) | ||
| 64 | to) | ||
| 65 | (end-of-line) | ||
| 66 | (setq to (point)) | ||
| 67 | |||
| 68 | (save-excursion | ||
| 69 | (set-buffer buf) | ||
| 70 | (insert-buffer-substring skkbuf from to) | ||
| 71 | (beginning-of-line) | ||
| 72 | (insert "\"") | ||
| 73 | (search-forward " ") | ||
| 74 | (delete-char 1) ; delete the first '/' | ||
| 75 | (let ((p (point))) | ||
| 76 | (end-of-line) | ||
| 77 | (delete-char -1) ; delete the last '/' | ||
| 78 | (subst-char-in-region p (point) ?/ ? 'noundo)) | ||
| 79 | (insert "\"\n")) | ||
| 80 | |||
| 81 | (forward-line 1))) | ||
| 82 | (save-excursion | ||
| 83 | (set-buffer buf) | ||
| 84 | (insert ")\n\n"))) | ||
| 85 | |||
| 86 | (defconst skkdic-postfix-list '(skkdic-postfix-list)) | ||
| 87 | |||
| 88 | (defconst skkdic-postfix-data | ||
| 89 | '(("$B$$$-(B" "$B9T(B") | ||
| 90 | ("$B$,$+$j(B" "$B78(B") | ||
| 91 | ("$B$,$/(B" "$B3X(B") | ||
| 92 | ("$B$,$o(B" "$B@n(B") | ||
| 93 | ("$B$7$c(B" "$B<R(B") | ||
| 94 | ("$B$7$e$&(B" "$B=8(B") | ||
| 95 | ("$B$7$g$&(B" "$B>^(B" "$B>k(B") | ||
| 96 | ("$B$8$g$&(B" "$B>k(B") | ||
| 97 | ("$B$;$s(B" "$B@~(B") | ||
| 98 | ("$B$@$1(B" "$B3Y(B") | ||
| 99 | ("$B$A$c$/(B" "$BCe(B") | ||
| 100 | ("$B$F$s(B" "$BE9(B") | ||
| 101 | ("$B$H$&$2(B" "$BF=(B") | ||
| 102 | ("$B$I$*$j(B" "$BDL$j(B") | ||
| 103 | ("$B$d$^(B" "$B;3(B") | ||
| 104 | ("$B$P$7(B" "$B66(B") | ||
| 105 | ("$B$O$D(B" "$BH/(B") | ||
| 106 | ("$B$b$/(B" "$BL\(B") | ||
| 107 | ("$B$f$-(B" "$B9T(B"))) | ||
| 108 | |||
| 109 | (defun skkdic-convert-postfix (skkbuf buf) | ||
| 110 | (message "Processing POSTFIX entries ...") | ||
| 111 | (goto-char (point-min)) | ||
| 112 | (save-excursion | ||
| 113 | (set-buffer buf) | ||
| 114 | (insert ";; Setting postfix entries.\n" | ||
| 115 | "(skkdic-set-postfix\n")) | ||
| 116 | |||
| 117 | ;; Initialize SKKDIC-POSTFIX-LIST by predefined data | ||
| 118 | ;; SKKDIC-POSTFIX-DATA. | ||
| 119 | (save-excursion | ||
| 120 | (set-buffer buf) | ||
| 121 | (let ((l skkdic-postfix-data) | ||
| 122 | kana candidates entry) | ||
| 123 | (while l | ||
| 124 | (setq kana (car (car l)) candidates (cdr (car l))) | ||
| 125 | (insert "\"" kana) | ||
| 126 | (while candidates | ||
| 127 | (insert " " (car candidates)) | ||
| 128 | (setq entry (lookup-nested-alist (car candidates) | ||
| 129 | skkdic-postfix-list nil nil t)) | ||
| 130 | (if (consp (car entry)) | ||
| 131 | (setcar entry (cons kana (car entry))) | ||
| 132 | (set-nested-alist (car candidates) (list kana) | ||
| 133 | skkdic-postfix-list)) | ||
| 134 | (setq candidates (cdr candidates))) | ||
| 135 | (insert "\"\n") | ||
| 136 | (setq l (cdr l))))) | ||
| 137 | |||
| 138 | ;; Search postfix entries. | ||
| 139 | (while (re-search-forward "^[#<>?]\\(\\cH+\\) " nil t) | ||
| 140 | (let ((kana (match-string 1)) | ||
| 141 | str candidates) | ||
| 142 | (while (looking-at "/[#0-9 ]*\\([^/\n]*\\)/") | ||
| 143 | (setq str (match-string 1)) | ||
| 144 | (if (not (member str candidates)) | ||
| 145 | (setq candidates (cons str candidates))) | ||
| 146 | (goto-char (match-end 1))) | ||
| 147 | (save-excursion | ||
| 148 | (set-buffer buf) | ||
| 149 | (insert "\"" kana) | ||
| 150 | (while candidates | ||
| 151 | (insert " " (car candidates)) | ||
| 152 | (let ((entry (lookup-nested-alist (car candidates) | ||
| 153 | skkdic-postfix-list nil nil t))) | ||
| 154 | (if (consp (car entry)) | ||
| 155 | (if (not (member kana (car entry))) | ||
| 156 | (setcar entry (cons kana (car entry)))) | ||
| 157 | (set-nested-alist (car candidates) (list kana) | ||
| 158 | skkdic-postfix-list))) | ||
| 159 | (setq candidates (cdr candidates))) | ||
| 160 | (insert "\"\n")))) | ||
| 161 | (save-excursion | ||
| 162 | (set-buffer buf) | ||
| 163 | (insert ")\n\n"))) | ||
| 164 | |||
| 165 | (defconst skkdic-prefix-list '(skkdic-prefix-list)) | ||
| 166 | |||
| 167 | (defun skkdic-convert-prefix (skkbuf buf) | ||
| 168 | (message "Processing PREFIX entries ...") | ||
| 169 | (goto-char (point-min)) | ||
| 170 | (save-excursion | ||
| 171 | (set-buffer buf) | ||
| 172 | (insert ";; Setting prefix entries.\n" | ||
| 173 | "(skkdic-set-prefix\n")) | ||
| 174 | (save-excursion | ||
| 175 | (while (re-search-forward "^\\(\\cH+\\)[<>?] " nil t) | ||
| 176 | (let ((kana (match-string 1)) | ||
| 177 | str candidates) | ||
| 178 | (while (looking-at "/\\([^/\n]+\\)/") | ||
| 179 | (setq str (match-string 1)) | ||
| 180 | (if (not (member str candidates)) | ||
| 181 | (setq candidates (cons str candidates))) | ||
| 182 | (goto-char (match-end 1))) | ||
| 183 | (save-excursion | ||
| 184 | (set-buffer buf) | ||
| 185 | (insert "\"" kana) | ||
| 186 | (while candidates | ||
| 187 | (insert " " (car candidates)) | ||
| 188 | (set-nested-alist (car candidates) kana skkdic-prefix-list) | ||
| 189 | (setq candidates (cdr candidates))) | ||
| 190 | (insert "\"\n"))))) | ||
| 191 | (save-excursion | ||
| 192 | (set-buffer buf) | ||
| 193 | (insert ")\n\n"))) | ||
| 194 | |||
| 195 | ;; FROM and TO point the head and tail of "/J../J../.../". | ||
| 196 | (defun skkdic-get-candidate-list (from to) | ||
| 197 | (let (candidates) | ||
| 198 | (goto-char from) | ||
| 199 | (while (re-search-forward "/\\cj+" to t) | ||
| 200 | (setq candidates (cons (buffer-substring (1+ (match-beginning 0)) | ||
| 201 | (match-end 0)) | ||
| 202 | candidates))) | ||
| 203 | candidates)) | ||
| 204 | |||
| 205 | ;; Return entry for STR from nested alist ALIST. | ||
| 206 | (defsubst skkdic-get-entry (str alist) | ||
| 207 | (car (lookup-nested-alist str alist nil nil t))) | ||
| 208 | |||
| 209 | |||
| 210 | (defconst skkdic-word-list '(skkdic-word-list)) | ||
| 211 | |||
| 212 | ;; Return t if substring of STR (between FROM and TO) can be broken up | ||
| 213 | ;; to chunks all of which can be derived from another entry in SKK | ||
| 214 | ;; dictionary. SKKBUF is the buffer where the original SKK dictionary | ||
| 215 | ;; is visited, KANA is the current entry for STR. FIRST is t iff this | ||
| 216 | ;; is called at top level. | ||
| 217 | |||
| 218 | (defun skkdic-breakup-string (skkbuf kana str from to &optional first) | ||
| 219 | (let ((len (- to from))) | ||
| 220 | (or (and (>= len 2) | ||
| 221 | (let ((min-idx (+ from 2)) | ||
| 222 | (idx (if first (1- to ) to)) | ||
| 223 | (found nil)) | ||
| 224 | (while (and (not found) (>= idx min-idx)) | ||
| 225 | (let ((kana2-list (skkdic-get-entry | ||
| 226 | (substring str from idx) | ||
| 227 | skkdic-word-list))) | ||
| 228 | (if (or (and (consp kana2-list) | ||
| 229 | (let ((kana-len (length kana)) | ||
| 230 | kana2) | ||
| 231 | (catch 'skkdic-tag | ||
| 232 | (while kana2-list | ||
| 233 | (setq kana2 (car kana2-list)) | ||
| 234 | (if (string-match kana2 kana) | ||
| 235 | (throw 'skkdic-tag t)) | ||
| 236 | (setq kana2-list (cdr kana2-list))))) | ||
| 237 | (or (= idx to) | ||
| 238 | (skkdic-breakup-string skkbuf kana str | ||
| 239 | idx to))) | ||
| 240 | (and (stringp kana2-list) | ||
| 241 | (string-match kana2-list kana))) | ||
| 242 | (setq found t) | ||
| 243 | (setq idx (1- idx))))) | ||
| 244 | found)) | ||
| 245 | (and first | ||
| 246 | (> len 2) | ||
| 247 | (let ((kana2 (skkdic-get-entry | ||
| 248 | (substring str from (1+ from)) | ||
| 249 | skkdic-prefix-list))) | ||
| 250 | (and (stringp kana2) | ||
| 251 | (eq (string-match kana2 kana) 0))) | ||
| 252 | (skkdic-breakup-string skkbuf kana str (1+ from) to)) | ||
| 253 | (and (not first) | ||
| 254 | (>= len 1) | ||
| 255 | (let ((kana2-list (skkdic-get-entry | ||
| 256 | (substring str from to) | ||
| 257 | skkdic-postfix-list))) | ||
| 258 | (and (consp kana2-list) | ||
| 259 | (let (kana2) | ||
| 260 | (catch 'skkdic-tag | ||
| 261 | (while kana2-list | ||
| 262 | (setq kana2 (car kana2-list)) | ||
| 263 | (if (string= kana2 | ||
| 264 | (substring kana (- (length kana2)))) | ||
| 265 | (throw 'skkdic-tag t)) | ||
| 266 | (setq kana2-list (cdr kana2-list))))))))))) | ||
| 267 | |||
| 268 | ;; Return list of candidates which excludes some from CANDIDATES. | ||
| 269 | ;; Excluded candidates can be derived from another entry. | ||
| 270 | |||
| 271 | (defun skkdic-reduced-candidates (skkbuf kana candidates) | ||
| 272 | (let (elt l) | ||
| 273 | (while candidates | ||
| 274 | (setq elt (car candidates)) | ||
| 275 | (if (or (= (length elt) 1) | ||
| 276 | (and (string-match "^\\cj" elt) | ||
| 277 | (not (skkdic-breakup-string skkbuf kana elt 0 (length elt) | ||
| 278 | 'first)))) | ||
| 279 | (setq l (cons elt l))) | ||
| 280 | (setq candidates (cdr candidates))) | ||
| 281 | (nreverse l))) | ||
| 282 | |||
| 283 | (defconst skkdic-okuri-nasi-entries (list nil)) | ||
| 284 | (defconst skkdic-okuri-nasi-entries-count 0) | ||
| 285 | |||
| 286 | (defun skkdic-collect-okuri-nasi () | ||
| 287 | (message "Collecting OKURI-NASI entries ...") | ||
| 288 | (save-excursion | ||
| 289 | (let ((prev-ratio 0) | ||
| 290 | ratio) | ||
| 291 | (while (re-search-forward "^\\(\\cH+\\) \\(/\\cj.*\\)/$" nil t) | ||
| 292 | (let ((kana (match-string 1)) | ||
| 293 | (candidates (skkdic-get-candidate-list (match-beginning 2) | ||
| 294 | (match-end 2)))) | ||
| 295 | (setq skkdic-okuri-nasi-entries | ||
| 296 | (cons (cons kana candidates) skkdic-okuri-nasi-entries) | ||
| 297 | skkdic-okuri-nasi-entries-count | ||
| 298 | (1+ skkdic-okuri-nasi-entries-count)) | ||
| 299 | (setq ratio (floor (/ (* (point) 100.0) (point-max)))) | ||
| 300 | (if (/= ratio prev-ratio) | ||
| 301 | (progn | ||
| 302 | (message "collected %2d%% %s ..." ratio kana) | ||
| 303 | (setq prev-ratio ratio))) | ||
| 304 | (while candidates | ||
| 305 | (let ((entry (lookup-nested-alist (car candidates) | ||
| 306 | skkdic-word-list nil nil t))) | ||
| 307 | (if (consp (car entry)) | ||
| 308 | (setcar entry (cons kana (car entry))) | ||
| 309 | (set-nested-alist (car candidates) (list kana) | ||
| 310 | skkdic-word-list))) | ||
| 311 | (setq candidates (cdr candidates)))))))) | ||
| 312 | |||
| 313 | (defun skkdic-convert-okuri-nasi (skkbuf buf) | ||
| 314 | (message "Processing OKURI-NASI entries ...") | ||
| 315 | (save-excursion | ||
| 316 | (set-buffer buf) | ||
| 317 | (insert ";; Setting okuri-nasi entries.\n" | ||
| 318 | "(skkdic-set-okuri-nasi\n") | ||
| 319 | (let ((l (nreverse skkdic-okuri-nasi-entries)) | ||
| 320 | (count 0) | ||
| 321 | (prev-ratio 0) | ||
| 322 | ratio) | ||
| 323 | (while l | ||
| 324 | (let ((kana (car (car l))) | ||
| 325 | (candidates (cdr (car l)))) | ||
| 326 | (setq ratio (/ (* count 1000) skkdic-okuri-nasi-entries-count) | ||
| 327 | count (1+ count)) | ||
| 328 | (if (/= prev-ratio (/ ratio 10)) | ||
| 329 | (progn | ||
| 330 | (message "processed %2d%% %s ..." (/ ratio 10) kana) | ||
| 331 | (setq prev-ratio (/ ratio 10)))) | ||
| 332 | (if (setq candidates | ||
| 333 | (skkdic-reduced-candidates skkbuf kana candidates)) | ||
| 334 | (progn | ||
| 335 | (insert "\"" kana) | ||
| 336 | (while candidates | ||
| 337 | (insert " " (car candidates)) | ||
| 338 | (setq candidates (cdr candidates))) | ||
| 339 | (insert "\"\n")))) | ||
| 340 | (setq l (cdr l)))) | ||
| 341 | (insert ")\n\n"))) | ||
| 342 | |||
| 343 | (defun skkdic-convert (filename &optional dirname) | ||
| 344 | "Convert SKK dictionary of FILENAME into the file \"skkdic.el\". | ||
| 345 | Optional argument DIRNAME if specified is the directory name under which | ||
| 346 | the generated \"skkdic.el\" is saved." | ||
| 347 | (interactive "FSKK dictionary file: ") | ||
| 348 | (message "Reading file \"%s\" ..." filename) | ||
| 349 | (let ((skkbuf(find-file-noselect (expand-file-name filename))) | ||
| 350 | (buf (get-buffer-create "*skkdic-work*"))) | ||
| 351 | (save-excursion | ||
| 352 | ;; Setup and generate the header part of working buffer. | ||
| 353 | (set-buffer buf) | ||
| 354 | (erase-buffer) | ||
| 355 | (buffer-disable-undo) | ||
| 356 | (insert ";; skkdic.el -- dictionary for Japanese input method\n" | ||
| 357 | ";;\tGenerated by the command `skkdic-convert'\n" | ||
| 358 | ";;\tDate: " (current-time-string) "\n" | ||
| 359 | ";;\tOriginal SKK dictionary file: " | ||
| 360 | (file-name-nondirectory filename) | ||
| 361 | "\n\n" | ||
| 362 | ";;; Comment:\n\n" | ||
| 363 | ";; Do byte-compile this file again after any modification.\n\n" | ||
| 364 | ";;; Start of the header of the original SKK dictionary.\n\n") | ||
| 365 | (set-buffer skkbuf) | ||
| 366 | (widen) | ||
| 367 | (goto-char 1) | ||
| 368 | (let (pos) | ||
| 369 | (search-forward ";; okuri-ari") | ||
| 370 | (forward-line 1) | ||
| 371 | (setq pos (point)) | ||
| 372 | (set-buffer buf) | ||
| 373 | (insert-buffer-substring skkbuf 1 pos)) | ||
| 374 | (insert "\n" | ||
| 375 | ";;; Code:\n\n(eval-when-compile (require 'skkdic-cnv))\n\n") | ||
| 376 | |||
| 377 | ;; Generate the body part of working buffer. | ||
| 378 | (set-buffer skkbuf) | ||
| 379 | (let ((from (point)) | ||
| 380 | to) | ||
| 381 | ;; Convert okuri-ari entries. | ||
| 382 | (search-forward ";; okuri-nasi") | ||
| 383 | (beginning-of-line) | ||
| 384 | (setq to (point)) | ||
| 385 | (narrow-to-region from to) | ||
| 386 | (skkdic-convert-okuri-ari skkbuf buf) | ||
| 387 | (widen) | ||
| 388 | |||
| 389 | ;; Convert okuri-nasi postfix entries. | ||
| 390 | (goto-char to) | ||
| 391 | (forward-line 1) | ||
| 392 | (setq from (point)) | ||
| 393 | (re-search-forward "^\\cH") | ||
| 394 | (setq to (match-beginning 0)) | ||
| 395 | (narrow-to-region from to) | ||
| 396 | (skkdic-convert-postfix skkbuf buf) | ||
| 397 | (widen) | ||
| 398 | |||
| 399 | ;; Convert okuri-nasi prefix entries. | ||
| 400 | (goto-char to) | ||
| 401 | (skkdic-convert-prefix skkbuf buf) | ||
| 402 | |||
| 403 | ;; | ||
| 404 | (skkdic-collect-okuri-nasi) | ||
| 405 | |||
| 406 | ;; Convert okuri-nasi general entries. | ||
| 407 | (skkdic-convert-okuri-nasi skkbuf buf) | ||
| 408 | |||
| 409 | ;; Postfix | ||
| 410 | (save-excursion | ||
| 411 | (set-buffer buf) | ||
| 412 | (goto-char (point-max)) | ||
| 413 | (insert ";;\n(provide 'skkdic)\n\n;; skkdic.el ends here\n"))) | ||
| 414 | |||
| 415 | ;; Save the working buffer. | ||
| 416 | (set-buffer buf) | ||
| 417 | (set-visited-file-name (expand-file-name skkdic-filename dirname) t) | ||
| 418 | (set-buffer-file-coding-system 'iso-2022-7bit-short) | ||
| 419 | (save-buffer 0)) | ||
| 420 | (kill-buffer skkbuf) | ||
| 421 | (switch-to-buffer buf))) | ||
| 422 | |||
| 423 | (defun batch-skkdic-convert () | ||
| 424 | "Run `skkdic-convert' on the files remaining on the command line. | ||
| 425 | Use this from the command line, with `-batch'; | ||
| 426 | it won't work in an interactive Emacs. | ||
| 427 | For example, invoke: | ||
| 428 | % emacs -batch -l skkdic-cnv -f batch-skkdic-convert SKK-JISYO.L | ||
| 429 | to generate \"skkdic.el\" from SKK dictionary file \"SKK-JISYO.L\". | ||
| 430 | To get complete usage, invoke: | ||
| 431 | % emacs -batch -l skkdic-cnv -f batch-skkdic-convert -h" | ||
| 432 | (defvar command-line-args-left) ; Avoid compiler warning. | ||
| 433 | (if (not noninteractive) | ||
| 434 | (error "`batch-skkdic-convert' should be used only with -batch")) | ||
| 435 | (if (string= (car command-line-args-left) "-h") | ||
| 436 | (progn | ||
| 437 | (message "To convert SKK-JISYO.L into skkdic.el:") | ||
| 438 | (message " %% emacs -batch -l skkdic-conv -f batch-skkdic-convert SKK-JISYO.L") | ||
| 439 | (message "To convert SKK-JISYO.L into DIR/skkdic.el:") | ||
| 440 | (message " %% emacs -batch -l skkdic-conv -f batch-skkdic-convert -dir DIR SKK-JISYO.L")) | ||
| 441 | (let (targetdir filename) | ||
| 442 | (if (string= (car command-line-args-left) "-dir") | ||
| 443 | (progn | ||
| 444 | (setq command-line-args-left (cdr command-line-args-left)) | ||
| 445 | (setq targetdir (expand-file-name (car command-line-args-left))) | ||
| 446 | (setq command-line-args-left (cdr command-line-args-left)))) | ||
| 447 | (setq filename (expand-file-name (car command-line-args-left))) | ||
| 448 | (message "Converting %s to skkdic.el ..." filename) | ||
| 449 | (message "It takes around 10 minutes even on Sun SS20.") | ||
| 450 | (skkdic-convert filename targetdir) | ||
| 451 | (message "Do byte-compile the created file by:") | ||
| 452 | (message " %% emacs -batch -f batch-byte-compile skkdic.el") | ||
| 453 | )) | ||
| 454 | (kill-emacs 0)) | ||
| 455 | |||
| 456 | |||
| 457 | ;; The following macros are expanded at byte-compiling time so that | ||
| 458 | ;; compiled code can be loaded quickly. | ||
| 459 | |||
| 460 | (defun skkdic-get-kana-compact-codes (kana) | ||
| 461 | (let* ((len (length kana)) | ||
| 462 | (vec (make-vector len 0)) | ||
| 463 | (i 0) | ||
| 464 | ch) | ||
| 465 | (while (< i len) | ||
| 466 | (setq ch (aref kana i)) | ||
| 467 | (aset vec i | ||
| 468 | (if (< ch 128) ; CH is an ASCII letter for OKURIGANA, | ||
| 469 | (- ch) ; represented by a negative code. | ||
| 470 | (if (= ch ?$B!<(B) ; `$B!<(B' is represented by 0. | ||
| 471 | 0 | ||
| 472 | (- (nth 2 (split-char ch)) 32)))) | ||
| 473 | (setq i (1+ i))) | ||
| 474 | vec)) | ||
| 475 | |||
| 476 | (defun skkdic-extract-conversion-data (entry) | ||
| 477 | (string-match "^\\cj+[a-z]* " entry) | ||
| 478 | (let ((kana (substring entry (match-beginning 0) (1- (match-end 0)))) | ||
| 479 | (i (match-end 0)) | ||
| 480 | candidates) | ||
| 481 | (while (string-match "[^ ]+" entry i) | ||
| 482 | (setq candidates (cons (match-string 0 entry) candidates)) | ||
| 483 | (setq i (match-end 0))) | ||
| 484 | (cons (skkdic-get-kana-compact-codes kana) candidates))) | ||
| 485 | |||
| 486 | (defmacro skkdic-set-okuri-ari (&rest entries) | ||
| 487 | `(defconst skkdic-okuri-ari | ||
| 488 | ',(let ((l entries) | ||
| 489 | (map '(skkdic-okuri-ari)) | ||
| 490 | entry) | ||
| 491 | (while l | ||
| 492 | (setq entry (skkdic-extract-conversion-data (car l))) | ||
| 493 | (set-nested-alist (car entry) (cdr entry) map) | ||
| 494 | (setq l (cdr l))) | ||
| 495 | map))) | ||
| 496 | |||
| 497 | (defmacro skkdic-set-postfix (&rest entries) | ||
| 498 | `(defconst skkdic-postfix | ||
| 499 | ',(let ((l entries) | ||
| 500 | (map '(nil)) | ||
| 501 | (longest 1) | ||
| 502 | len entry) | ||
| 503 | (while l | ||
| 504 | (setq entry (skkdic-extract-conversion-data (car l))) | ||
| 505 | (setq len (length (car entry))) | ||
| 506 | (if (> len longest) | ||
| 507 | (setq longest len)) | ||
| 508 | (let ((entry2 (lookup-nested-alist (car entry) map nil nil t))) | ||
| 509 | (if (consp (car entry2)) | ||
| 510 | (let ((conversions (cdr entry))) | ||
| 511 | (while conversions | ||
| 512 | (if (not (member (car conversions) (car entry2))) | ||
| 513 | (setcar entry2 (cons (car conversions) (car entry2)))) | ||
| 514 | (setq conversions (cdr conversions)))) | ||
| 515 | (set-nested-alist (car entry) (cdr entry) map))) | ||
| 516 | (setq l (cdr l))) | ||
| 517 | (setcar map longest) | ||
| 518 | map))) | ||
| 519 | |||
| 520 | (defmacro skkdic-set-prefix (&rest entries) | ||
| 521 | `(defconst skkdic-prefix | ||
| 522 | ',(let ((l entries) | ||
| 523 | (map '(nil)) | ||
| 524 | (longest 1) | ||
| 525 | len entry) | ||
| 526 | (while l | ||
| 527 | (setq entry (skkdic-extract-conversion-data (car l))) | ||
| 528 | (setq len (length (car entry))) | ||
| 529 | (if (> len longest) | ||
| 530 | (setq longest len)) | ||
| 531 | (let ((entry2 (lookup-nested-alist (car entry) map len nil t))) | ||
| 532 | (if (consp (car entry2)) | ||
| 533 | (let ((conversions (cdr entry))) | ||
| 534 | (while conversions | ||
| 535 | (if (not (member (car conversions) (car entry2))) | ||
| 536 | (setcar entry2 (cons (car conversions) (car entry2)))) | ||
| 537 | (setq conversions (cdr conversions)))) | ||
| 538 | (set-nested-alist (car entry) (cdr entry) map len))) | ||
| 539 | (setq l (cdr l))) | ||
| 540 | (setcar map longest) | ||
| 541 | map))) | ||
| 542 | |||
| 543 | (defmacro skkdic-set-okuri-nasi (&rest entries) | ||
| 544 | `(defconst skkdic-okuri-nasi | ||
| 545 | ',(let ((l entries) | ||
| 546 | (map '(skdic-okuri-nasi)) | ||
| 547 | (count 0) | ||
| 548 | entry) | ||
| 549 | (while l | ||
| 550 | (setq count (1+ count)) | ||
| 551 | (if (= (% count 10) 0) | ||
| 552 | (message (format "%d entries" count))) | ||
| 553 | (setq entry (skkdic-extract-conversion-data (car l))) | ||
| 554 | (set-nested-alist (car entry) (cdr entry) map) | ||
| 555 | (setq l (cdr l))) | ||
| 556 | map))) | ||
| 557 | |||
| 558 | (provide 'skkdic-cnv) | ||
| 559 | |||
| 560 | ;; skkdic-cnv.el ends here | ||
diff --git a/lisp/international/skkdic-utl.el b/lisp/international/skkdic-utl.el deleted file mode 100644 index a0f622bd924..00000000000 --- a/lisp/international/skkdic-utl.el +++ /dev/null | |||
| @@ -1,214 +0,0 @@ | |||
| 1 | ;;; skkdic-utl.el --- Utility functions for handling SKK dictionary | ||
| 2 | |||
| 3 | ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN. | ||
| 4 | ;; Licensed to the Free Software Foundation. | ||
| 5 | |||
| 6 | ;; Keywords: mule, multilingual, Japanese, SKK | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software; you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 | ;; any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | ||
| 22 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 23 | ;; Boston, MA 02111-1307, USA. | ||
| 24 | |||
| 25 | ;;; Commentary: | ||
| 26 | |||
| 27 | ;; SKK is a free Japanese input method running on Mule created by | ||
| 28 | ;; Masahiko Sato <masahiko@sato.riec.tohoku.ac.jp>. The Emacs Lisp | ||
| 29 | ;; library kkc.el provides a facility to convert a Japanese kana | ||
| 30 | ;; string to a kanji-kana-mixed string by using a SKK dictionary. | ||
| 31 | ;; | ||
| 32 | ;; This file provides a generic function to look up a SKK dictionary. | ||
| 33 | ;; | ||
| 34 | ;; The original SKK dictionary SKK-JISYO.L is converted to skkdic.el. | ||
| 35 | ;; We get entries of the dictionary in four variables (listed below) | ||
| 36 | ;; by loadig this file (or byte-compiled version skkdic.elc). | ||
| 37 | |||
| 38 | ;;; Code: | ||
| 39 | |||
| 40 | ;; The following four variables are set by loading skkdic.el[c]. | ||
| 41 | (defvar skkdic-okuri-ari nil | ||
| 42 | "Nested alist for OKURI-ARI entries of SKK dictionary.") | ||
| 43 | |||
| 44 | (defvar skkdic-postfix nil | ||
| 45 | "Nested alist for SETSUBIJI (postfix) entries of SKK dictionary.") | ||
| 46 | |||
| 47 | (defvar skkdic-prefix nil | ||
| 48 | "Nested alist SETTOUJI (prefix) entries of SKK dictionary.") | ||
| 49 | |||
| 50 | (defvar skkdic-okuri-nasi nil | ||
| 51 | "Nested alist for OKURI-NASI entries of SKK dictionary.") | ||
| 52 | |||
| 53 | (defconst skkdic-okurigana-table | ||
| 54 | '((?$B$!(B . ?a) (?$B$"(B . ?a) (?$B$#(B . ?i) (?$B$$(B . ?i) (?$B$%(B . ?u) | ||
| 55 | (?$B$&(B . ?u) (?$B$'(B . ?e) (?$B$((B . ?e) (?$B$)(B . ?o) (?$B$*(B . ?o) | ||
| 56 | (?$B$+(B . ?k) (?$B$,(B . ?g) (?$B$-(B . ?k) (?$B$.(B . ?g) (?$B$/(B . ?k) | ||
| 57 | (?$B$0(B . ?g) (?$B$1(B . ?k) (?$B$2(B . ?g) (?$B$3(B . ?k) (?$B$4(B . ?g) | ||
| 58 | (?$B$5(B . ?s) (?$B$6(B . ?z) (?$B$7(B . ?s) (?$B$8(B . ?j) (?$B$9(B . ?s) | ||
| 59 | (?$B$:(B . ?z) (?$B$;(B . ?s) (?$B$<(B . ?z) (?$B$=(B . ?s) (?$B$>(B . ?z) | ||
| 60 | (?$B$?(B . ?t) (?$B$@(B . ?d) (?$B$A(B . ?t) (?$B$B(B . ?d) (?$B$C(B . ?t) | ||
| 61 | (?$B$D(B . ?t) (?$B$E(B . ?d) (?$B$F(B . ?t) (?$B$G(B . ?d) (?$B$H(B . ?t) (?$B$I(B . ?d) | ||
| 62 | (?$B$J(B . ?n) (?$B$K(B . ?n) (?$B$L(B . ?n) (?$B$M(B . ?n) (?$B$N(B . ?n) | ||
| 63 | (?$B$O(B . ?h) (?$B$P(B . ?b) (?$B$Q(B . ?p) (?$B$R(B . ?h) (?$B$S(B . ?b) | ||
| 64 | (?$B$T(B . ?p) (?$B$U(B . ?h) (?$B$V(B . ?b) (?$B$W(B . ?p) (?$B$X(B . ?h) | ||
| 65 | (?$B$Y(B . ?b) (?$B$Z(B . ?p) (?$B$[(B . ?h) (?$B$\(B . ?b) (?$B$](B . ?p) | ||
| 66 | (?$B$^(B . ?m) (?$B$_(B . ?m) (?$B$`(B . ?m) (?$B$a(B . ?m) (?$B$b(B . ?m) | ||
| 67 | (?$B$c(B . ?y) (?$B$d(B . ?y) (?$B$e(B . ?y) (?$B$f(B . ?y) (?$B$g(B . ?y) (?$B$h(B . ?y) | ||
| 68 | (?$B$i(B . ?r) (?$B$j(B . ?r) (?$B$k(B . ?r) (?$B$l(B . ?r) (?$B$m(B . ?r) | ||
| 69 | (?$B$o(B . ?w) (?$B$p(B . ?w) (?$B$q(B . ?w) (?$B$r(B . ?w) | ||
| 70 | (?$B$s(B . ?n) | ||
| 71 | ) | ||
| 72 | "Alist of Okuriganas vs trailing ASCII letters in OKURI-ARI entry.") | ||
| 73 | |||
| 74 | (defun skkdic-merge-head-and-tail (heads tails postfix) | ||
| 75 | (let ((min-len 2) | ||
| 76 | l) | ||
| 77 | (while heads | ||
| 78 | (if (or (not postfix) | ||
| 79 | (>= (length (car heads)) min-len)) | ||
| 80 | (let ((tail tails)) | ||
| 81 | (while tail | ||
| 82 | (if (or postfix | ||
| 83 | (>= (length (car tail)) min-len)) | ||
| 84 | (setq l (cons (concat (car heads) (car tail)) l))) | ||
| 85 | (setq tail (cdr tail))))) | ||
| 86 | (setq heads (cdr heads))) | ||
| 87 | l)) | ||
| 88 | |||
| 89 | (defconst skkdic-jisx0208-hiragana-block (nth 1 (split-char ?$B$"(B))) | ||
| 90 | |||
| 91 | (defun skkdic-lookup-key (seq len &optional postfix prefer-noun) | ||
| 92 | "Return a list of conversion string for sequence SEQ of length LEN. | ||
| 93 | |||
| 94 | SEQ is a vector of Kana characters to be converted by SKK dictionary. | ||
| 95 | If LEN is shorter than the length of KEYSEQ, the first LEN keys in SEQ | ||
| 96 | are took into account. | ||
| 97 | |||
| 98 | Optional 3rd arg POSTFIX non-nil means SETSUBIJI (postfix) are also | ||
| 99 | considered to find conversion strings. | ||
| 100 | |||
| 101 | Optional 4th arg PREFER-NOUN non-nil means that the conversions | ||
| 102 | without okurigana are placed at the head of the returned list." | ||
| 103 | (or skkdic-okuri-nasi | ||
| 104 | (condition-case err | ||
| 105 | (load-library "skk/skkdic") | ||
| 106 | (error (ding) | ||
| 107 | (with-output-to-temp-buffer "*Help*" | ||
| 108 | (princ "The library `skkdic' can't be loaded. | ||
| 109 | |||
| 110 | The most common case is that you have not yet installed the library | ||
| 111 | included in LEIM (Libraries of Emacs Input Method) which is | ||
| 112 | distributed separately from Emacs. | ||
| 113 | |||
| 114 | LEIM is available from the same ftp directory as Emacs.")) | ||
| 115 | (signal (car err) (cdr err))))) | ||
| 116 | |||
| 117 | (let ((vec (make-vector len 0)) | ||
| 118 | (i 0) | ||
| 119 | entry) | ||
| 120 | ;; At first, generate vector VEC from SEQ for looking up SKK | ||
| 121 | ;; alists. Nth element in VEC corresponds to Nth element in SEQ. | ||
| 122 | ;; The values are decided as follows. | ||
| 123 | ;; If SEQ[N] is `$B!<(B', VEC[N] is 0, | ||
| 124 | ;; else if SEQ[N] is a Hiragana character, VEC[N] is: | ||
| 125 | ;; ((The 2nd position code of SEQ[N]) - 32), | ||
| 126 | ;; else VEC[N] is 128. | ||
| 127 | (while (< i len) | ||
| 128 | (let ((ch (aref seq i)) | ||
| 129 | elts) | ||
| 130 | (if (= ch ?$B!<(B) | ||
| 131 | (aset vec i 0) | ||
| 132 | (setq elts (split-char ch)) | ||
| 133 | (if (and (eq (car elts) 'japanese-jisx0208) | ||
| 134 | (= (nth 1 elts) skkdic-jisx0208-hiragana-block)) | ||
| 135 | (aset vec i (- (nth 2 elts) 32)) | ||
| 136 | (aset vec i 128)))) | ||
| 137 | (setq i (1+ i))) | ||
| 138 | |||
| 139 | ;; Search OKURI-NASI entries. | ||
| 140 | (setq entry (lookup-nested-alist vec skkdic-okuri-nasi len 0 t)) | ||
| 141 | (if (consp (car entry)) | ||
| 142 | (setq entry (copy-sequence (car entry))) | ||
| 143 | (setq entry nil)) | ||
| 144 | |||
| 145 | (if postfix | ||
| 146 | ;; Search OKURI-NASI entries with postfixes. | ||
| 147 | (let ((break (max (- len (car skkdic-postfix)) 1)) | ||
| 148 | entry-head entry-postfix entry2) | ||
| 149 | (while (< break len) | ||
| 150 | (if (and (setq entry-head | ||
| 151 | (lookup-nested-alist vec skkdic-okuri-nasi | ||
| 152 | break 0 t)) | ||
| 153 | (consp (car entry-head)) | ||
| 154 | (setq entry-postfix | ||
| 155 | (lookup-nested-alist vec skkdic-postfix | ||
| 156 | len break t)) | ||
| 157 | (consp (car entry-postfix)) | ||
| 158 | (setq entry2 (skkdic-merge-head-and-tail | ||
| 159 | (car entry-head) (car entry-postfix) t))) | ||
| 160 | (if entry | ||
| 161 | (nconc entry entry2) | ||
| 162 | (setq entry entry2))) | ||
| 163 | (setq break (1+ break))))) | ||
| 164 | |||
| 165 | ;; Search OKURI-NASI entries with prefixes. | ||
| 166 | (let ((break (min (car skkdic-prefix) (- len 2))) | ||
| 167 | entry-prefix entry-tail entry2) | ||
| 168 | (while (> break 0) | ||
| 169 | (if (and (setq entry-prefix | ||
| 170 | (lookup-nested-alist vec skkdic-prefix break 0 t)) | ||
| 171 | (consp (car entry-prefix)) | ||
| 172 | (setq entry-tail | ||
| 173 | (lookup-nested-alist vec skkdic-okuri-nasi len break t)) | ||
| 174 | (consp (car entry-tail)) | ||
| 175 | (setq entry2 (skkdic-merge-head-and-tail | ||
| 176 | (car entry-prefix) (car entry-tail) nil))) | ||
| 177 | (progn | ||
| 178 | (if entry | ||
| 179 | (nconc entry entry2) | ||
| 180 | (setq entry entry2)))) | ||
| 181 | (setq break (1- break)))) | ||
| 182 | |||
| 183 | ;; Search OKURI-ARI entries. | ||
| 184 | (let ((okurigana (assq (aref seq (1- len)) skkdic-okurigana-table)) | ||
| 185 | orig-element entry2) | ||
| 186 | (if okurigana | ||
| 187 | (progn | ||
| 188 | (setq orig-element (aref vec (1- len))) | ||
| 189 | (aset vec (1- len) (- (cdr okurigana))) | ||
| 190 | (if (and (setq entry2 (lookup-nested-alist vec skkdic-okuri-ari | ||
| 191 | len 0 t)) | ||
| 192 | (consp (car entry2))) | ||
| 193 | (progn | ||
| 194 | (setq entry2 (copy-sequence (car entry2))) | ||
| 195 | (let ((l entry2) | ||
| 196 | (okuri (char-to-string (aref seq (1- len))))) | ||
| 197 | (while l | ||
| 198 | (setcar l (concat (car l) okuri)) | ||
| 199 | (setq l (cdr l))) | ||
| 200 | (if entry | ||
| 201 | (if prefer-noun | ||
| 202 | (nconc entry entry2) | ||
| 203 | (setq entry2 (nreverse entry2)) | ||
| 204 | (nconc entry2 entry) | ||
| 205 | (setq entry entry2)) | ||
| 206 | (setq entry (nreverse entry2)))))) | ||
| 207 | (aset vec (1- len) orig-element)))) | ||
| 208 | |||
| 209 | entry)) | ||
| 210 | |||
| 211 | ;; | ||
| 212 | (provide 'skkdic-utl) | ||
| 213 | |||
| 214 | ;; skkdic-utl.el ends here | ||