diff options
| author | Kenichi Handa | 1997-07-07 00:53:02 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1997-07-07 00:53:02 +0000 |
| commit | c7c9a4a184915c7ea17ed03f89dc0a6449523ee2 (patch) | |
| tree | ba6faf62206eed03de410d562b8349d6a698b7c9 | |
| parent | 93303c998df0354042a47f896b7f87def309b584 (diff) | |
| download | emacs-c7c9a4a184915c7ea17ed03f89dc0a6449523ee2.tar.gz emacs-c7c9a4a184915c7ea17ed03f89dc0a6449523ee2.zip | |
(skkdic-okuri-ari): Doc-string
modified.
(skkdic-postfix, skkdic-prefix, skkdic-okuri-nasi): Likewise.
(skkdic-lookup-key): Add 4th argument PREFER-NOUN. Arrange order
of returning list according to this value.
| -rw-r--r-- | lisp/international/skkdic-utl.el | 58 |
1 files changed, 38 insertions, 20 deletions
diff --git a/lisp/international/skkdic-utl.el b/lisp/international/skkdic-utl.el index 628814c4e71..c6750ab1683 100644 --- a/lisp/international/skkdic-utl.el +++ b/lisp/international/skkdic-utl.el | |||
| @@ -25,23 +25,31 @@ | |||
| 25 | ;;; Commentary: | 25 | ;;; Commentary: |
| 26 | 26 | ||
| 27 | ;; SKK is a free Japanese input method running on Mule created by | 27 | ;; SKK is a free Japanese input method running on Mule created by |
| 28 | ;; Masahiko Sato <masahiko@sato.riec.tohoku.ac.jp>. A dictionary of | 28 | ;; Masahiko Sato <masahiko@sato.riec.tohoku.ac.jp>. The Emacs Lisp |
| 29 | ;; SKK can be converted by `skkdic-convert' (skkdic-conv.el) to a file | 29 | ;; library kkc.el provides a facility to convert a Japanese kana |
| 30 | ;; "skkdic.el" in which the dictionary entries are defined in the | 30 | ;; string to a kanji-kana-mixed string by using a SKK dictionary. |
| 31 | ;; format which can be handled by the following functions. | 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). | ||
| 32 | 37 | ||
| 33 | ;;; Code: | 38 | ;;; Code: |
| 34 | 39 | ||
| 40 | ;; The following four variables are set by loading skkdic.el[c]. | ||
| 35 | (defvar skkdic-okuri-ari nil | 41 | (defvar skkdic-okuri-ari nil |
| 36 | "OKURI-ARI entries of SKK dictionary.") | 42 | "Nested alist for OKURI-ARI entries of SKK dictionary.") |
| 43 | |||
| 37 | (defvar skkdic-postfix nil | 44 | (defvar skkdic-postfix nil |
| 38 | "POSTFIX entries of SKK dictionary.") | 45 | "Nested alist for SETSUBIJI (postfix) entries of SKK dictionary.") |
| 46 | |||
| 39 | (defvar skkdic-prefix nil | 47 | (defvar skkdic-prefix nil |
| 40 | "PREFIX entries of SKK dictionary.") | 48 | "Nested alist SETTOUJI (prefix) entries of SKK dictionary.") |
| 49 | |||
| 41 | (defvar skkdic-okuri-nasi nil | 50 | (defvar skkdic-okuri-nasi nil |
| 42 | "OKURI-NASI entries of SKK dictionary.") | 51 | "Nested alist for OKURI-NASI entries of SKK dictionary.") |
| 43 | 52 | ||
| 44 | ;; Alist of Okuriganas vs trailing ASCII letters in OKURI-ARI entry. | ||
| 45 | (defconst skkdic-okurigana-table | 53 | (defconst skkdic-okurigana-table |
| 46 | '((?$B$!(B . ?a) (?$B$"(B . ?a) (?$B$#(B . ?i) (?$B$$(B . ?i) (?$B$%(B . ?u) | 54 | '((?$B$!(B . ?a) (?$B$"(B . ?a) (?$B$#(B . ?i) (?$B$$(B . ?i) (?$B$%(B . ?u) |
| 47 | (?$B$&(B . ?u) (?$B$'(B . ?e) (?$B$((B . ?e) (?$B$)(B . ?o) (?$B$*(B . ?o) | 55 | (?$B$&(B . ?u) (?$B$'(B . ?e) (?$B$((B . ?e) (?$B$)(B . ?o) (?$B$*(B . ?o) |
| @@ -60,7 +68,8 @@ | |||
| 60 | (?$B$i(B . ?r) (?$B$j(B . ?r) (?$B$k(B . ?r) (?$B$l(B . ?r) (?$B$m(B . ?r) | 68 | (?$B$i(B . ?r) (?$B$j(B . ?r) (?$B$k(B . ?r) (?$B$l(B . ?r) (?$B$m(B . ?r) |
| 61 | (?$B$o(B . ?w) (?$B$p(B . ?w) (?$B$q(B . ?w) (?$B$r(B . ?w) | 69 | (?$B$o(B . ?w) (?$B$p(B . ?w) (?$B$q(B . ?w) (?$B$r(B . ?w) |
| 62 | (?$B$s(B . ?n) | 70 | (?$B$s(B . ?n) |
| 63 | )) | 71 | ) |
| 72 | "Alist of Okuriganas vs trailing ASCII letters in OKURI-ARI entry.") | ||
| 64 | 73 | ||
| 65 | (defconst skkdic-jbytes | 74 | (defconst skkdic-jbytes |
| 66 | (charset-bytes 'japanese-jisx0208)) | 75 | (charset-bytes 'japanese-jisx0208)) |
| @@ -82,14 +91,18 @@ | |||
| 82 | 91 | ||
| 83 | (defconst skkdic-jisx0208-hiragana-block (nth 1 (split-char ?$B$"(B))) | 92 | (defconst skkdic-jisx0208-hiragana-block (nth 1 (split-char ?$B$"(B))) |
| 84 | 93 | ||
| 85 | (defun skkdic-lookup-key (seq len &optional postfix) | 94 | (defun skkdic-lookup-key (seq len &optional postfix prefer-noun) |
| 86 | "Return a list of conversion string for sequence SEQ of length LEN. | 95 | "Return a list of conversion string for sequence SEQ of length LEN. |
| 87 | 96 | ||
| 88 | SEQ is a vector of Kana characters to be converted by SKK dictionary. | 97 | SEQ is a vector of Kana characters to be converted by SKK dictionary. |
| 89 | If LEN is shorter than the length of KEYSEQ, the first LEN keys in SEQ | 98 | If LEN is shorter than the length of KEYSEQ, the first LEN keys in SEQ |
| 90 | are took into account. | 99 | are took into account. |
| 91 | 100 | ||
| 92 | Postfixes are handled only if the optional argument POSTFIX is non-nil." | 101 | Optional 3rd arg POSTFIX non-nil means SETSUBIJI (postfix) are also |
| 102 | considered to find conversion strings. | ||
| 103 | |||
| 104 | Optional 4th arg PREFER-NOUN non-nil means that the conversions | ||
| 105 | without okurigana are placed at the head of the returned list." | ||
| 93 | (or skkdic-okuri-nasi | 106 | (or skkdic-okuri-nasi |
| 94 | (condition-case err | 107 | (condition-case err |
| 95 | (load-library "skk/skkdic") | 108 | (load-library "skk/skkdic") |
| @@ -111,9 +124,9 @@ LEIM is available from the same ftp directory as Emacs.")) | |||
| 111 | ;; alists. Nth element in VEC corresponds to Nth element in SEQ. | 124 | ;; alists. Nth element in VEC corresponds to Nth element in SEQ. |
| 112 | ;; The values are decided as follows. | 125 | ;; The values are decided as follows. |
| 113 | ;; If SEQ[N] is `$B!<(B', VEC[N] is 0, | 126 | ;; If SEQ[N] is `$B!<(B', VEC[N] is 0, |
| 114 | ;; Else if SEQ[N] is a Hiragana character, VEC[N] is: | 127 | ;; else if SEQ[N] is a Hiragana character, VEC[N] is: |
| 115 | ;; ((The 2nd position code o SEQ[N]) - 32), | 128 | ;; ((The 2nd position code of SEQ[N]) - 32), |
| 116 | ;; ELse VEC[N] is 128. | 129 | ;; else VEC[N] is 128. |
| 117 | (while (< i len) | 130 | (while (< i len) |
| 118 | (let ((ch (aref seq i)) | 131 | (let ((ch (aref seq i)) |
| 119 | elts) | 132 | elts) |
| @@ -164,9 +177,10 @@ LEIM is available from the same ftp directory as Emacs.")) | |||
| 164 | (consp (car entry-tail)) | 177 | (consp (car entry-tail)) |
| 165 | (setq entry2 (skkdic-merge-head-and-tail | 178 | (setq entry2 (skkdic-merge-head-and-tail |
| 166 | (car entry-prefix) (car entry-tail) nil))) | 179 | (car entry-prefix) (car entry-tail) nil))) |
| 167 | (if entry | 180 | (progn |
| 168 | (nconc entry entry2) | 181 | (if entry |
| 169 | (setq entry entry2))) | 182 | (nconc entry entry2) |
| 183 | (setq entry entry2)))) | ||
| 170 | (setq break (1- break)))) | 184 | (setq break (1- break)))) |
| 171 | 185 | ||
| 172 | ;; Search OKURI-ARI entries. | 186 | ;; Search OKURI-ARI entries. |
| @@ -187,8 +201,12 @@ LEIM is available from the same ftp directory as Emacs.")) | |||
| 187 | (setcar l (concat (car l) okuri)) | 201 | (setcar l (concat (car l) okuri)) |
| 188 | (setq l (cdr l))) | 202 | (setq l (cdr l))) |
| 189 | (if entry | 203 | (if entry |
| 190 | (nconc entry entry2) | 204 | (if prefer-noun |
| 191 | (setq entry entry2))))) | 205 | (nconc entry entry2) |
| 206 | (setq entry2 (nreverse entry2)) | ||
| 207 | (nconc entry2 entry) | ||
| 208 | (setq entry entry2)) | ||
| 209 | (setq entry (nreverse entry2)))))) | ||
| 192 | (aset vec (1- len) orig-element)))) | 210 | (aset vec (1- len) orig-element)))) |
| 193 | 211 | ||
| 194 | entry)) | 212 | entry)) |