;;; skkdic-ext.el --- An extension for skkdic-util to support conjugation ;; Copyright (C) 1996 MORIOKA Tomohiko ;; Author: MORIOKA Tomohiko ;; Version: $Id: skkdic-ext.el,v 0.7 1996/11/12 09:13:25 morioka Exp $ ;; Keywords: input, Japanese, mule ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License as ;; published by the Free Software Foundation; either version 2, or (at ;; your option) any later version. ;; This program is distributed in the hope that it will be useful, but ;; WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Code: (require 'skkdic-util) (or (fboundp 'orig::skkdic-lookup-key) (fset 'orig::skkdic-lookup-key (symbol-function 'skkdic-lookup-key)) ) (defun skkdic-lookup-key (vec len &optional postfix ps) "Return a list of conversion string for sequence SEQ of length LEN. SEQ is a vector of Kana characters to be converted by SKK dictionary. If LEN is shorter than the length of KEYSEQ, the first LEN keys in SEQ is concerned. Postfixes are concerned only if the optional argument POSTFIX is non-nil. \[skkdic-ext.el]" (let ((dest (reverse (orig::skkdic-lookup-key vec len nil)))) (setq vec (subseq (copy-sequence vec) 0 len)) (let ((ws (cdr (assq ps skkdic-ext-suffix)))) (mapcar (lambda (word) (let ((ret (bottom-vector-string-match (aref word 1) vec))) (if ret (let* ((lr (length (cdr ret))) (pre (car ret)) (lpre (length pre)) ) (if (= lpre 0) (let ((str (mapconcat (function char-to-string) (aref word 2) ""))) (or (member str dest) (setq dest (cons str dest)) ) ) (let ((rret (skkdic-lookup-key pre lpre nil (aref word 0))) ) (if rret (let ((suf (mapconcat (function char-to-string) (aref word 2) ""))) (mapcar (lambda (r) (let ((str (concat (mapconcat (function char-to-string) r "") suf))) (or (member str dest) (setq dest (cons str dest)) ))) rret))) )))))) ws)) dest)) (setq skkdic-ext-suffix '((nil [nil "。" "。"] [nil "、" "、"] [nil "?" "?"] [nil ":" ":"] [nil ";" ";"] [nil "ばあい" "場合"] [nil "ほうほう" "方法"] [noun "より" "より"] [noun "から" "から"] [noun "へは" "へは"] [noun "かも" "かも"] [noun "でも" "でも"] [noun "では" "では"] [noun "よ" "よ"] [noun "は" "は"] [noun "が" "が"] [noun "に" "に"] [noun "を" "を"] [noun "へ" "へ"] [noun "の" "の"] [noun "と" "と"] [noun "か" "か"] [noun "も" "も"] [noun "で" "で"] [noun "か" "化"] [noun "か" "か"] [noun "す" "す"] [mizen "う" "う"] [renyou "た" "た"] [renyou "て" "て"] [renyou "だ" "だ"] [v-u1 "る" "る"] [v-u1 "れ" "れ"] [v-u1 "よ" "よ"] [v-k5 "く" "く"] [v-k5 "け" "け"] [v-g5 "ぐ" "ぐ"] [v-g5 "げ" "げ"] [v-s5 "す" "す"] [nil "す" "す"] [nil "する" "する"] [nil "すれ" "すれ"] [nil "せよ" "せよ"] [nil "しろ" "しろ"] [v-s5 "せ" "せ"] [v-t5 "つ" "つ"] [v-t5 "て" "て"] [v-n5 "ぬ" "ぬ"] [v-n5 "ね" "ね"] [v-m5 "む" "む"] [v-m5 "め" "め"] [v-b5 "ぶ" "ぶ"] [v-b5 "べ" "べ"] [v-r5 "る" "る"] [v-r5 "れ" "れ"] [v-w5 "う" "う"] [v-w5 "え" "え"] [adj "い" "い"] [adj "けれ" "けれ"] [noun "しゃ" "者"] ) (noun [nil "あふぉーだんす" "アフォーダンス"] [nil "じょうほう" "情報"] ) (mizen [adj "かろ" "かろ"] [v-k5 "か" "か"] [v-k5 "こ" "こ"] [v-g5 "が" "が"] [v-g5 "ご" "ご"] [v-s5 "さ" "さ"] [v-s5 "そ" "そ"] [nil "せ" "せ"] [v-t5 "た" "た"] [v-t5 "と" "と"] [v-n5 "な" "な"] [v-n5 "の" "の"] [v-m5 "ま" "ま"] [v-m5 "も" "も"] [v-b5 "ば" "ば"] [v-b5 "ぼ" "ぼ"] [v-r5 "ら" "ら"] [v-r5 "ろ" "ろ"] [v-w5 "わ" "わ"] [v-w5 "お" "お"] ) (renyou [adj "かっ" "かっ"] [adj "く" "く"] [renyou "まし" "まし"] [v-5i "い" "い"] [v-5q "っ" "っ"] [v-5n "ん" "ん"] [v-k5 "き" "き"] [v-k5 "ぎ" "ぎ"] [v-s5 "し" "し"] [nil "し" "し"] [v-t5 "ち" "ち"] [v-n5 "に" "に"] [v-m5 "み" "み"] [v-b5 "び" "び"] [v-r5 "り" "り"] ) (v-5i [nil "か" "書"] ) (v-s5 [nil "かん" "関"] ) (adj [nil "らし" "らし"] [nil "な" "な"] ) )) (defun bottom-vector-string-match (pat seq) (or (vectorp pat) (setq pat (string-to-vector pat)) ) (if (vectorp seq) (setq seq (copy-sequence seq)) (setq seq (string-to-vector seq)) ) (let ((lp (length pat)) (ls (length seq)) ) (if (> lp ls) nil (catch 'not-matched (while (> lp 0) (setq lp (1- lp) ls (1- ls)) (or (eq (aref pat lp)(aref seq ls)) (throw 'not-matched nil) ) ) (cons (subseq seq 0 ls) pat) )))) (defvar sana-prefix ;;(setq sana-prefix '((1 (adj ["く" "く"] ["し" "し"] ["き" "き"] ["い" "い"] ["さ" "さ"] ) ;; (v-k* ;; ["き" "き"] ;; ["き" "来"] ;; ["き" "來"] ;; ["く" "く"] ;; ["く" "来"] ;; ["く" "來"] ;; ["こ" "こ"] ;; ["こ" "来"] ;; ["こ" "來"] ;; ) ;; (v-s* ;; ["し" "し"] ;; ["せ" "せ"] ;; ) ;; (v-z* ;; ["じ" "じ"] ;; ["ず" "ず"] ;; ["ぜ" "ぜ"] ;; ) (+v-nari ["に" "に"] ) (+v-tari ["と" "と"] ) (+v-da ["で" "で"] ["に" "に"] ["な" "な"] ) (+v-ya ["え" "ぇ"] ["や" "や"] ) ) (2 (v-k* ["くる" "くる"] ["くる" "来る"] ["くる" "來る"] ["くれ" "くれ"] ["くれ" "来れ"] ["くれ" "來れ"] ["こよ" "こよ"] ["こよ" "来よ"] ["こよ" "來よ"] ["こい" "こい"] ["こい" "来い"] ["こい" "來い"] ) (v-s* ["する" "する"] ["すれ" "すれ"] ["され" "され"] ["せよ" "せよ"] ) (v-z* ["ずる" "ずる"] ["ずれ" "ずれ"] ["ぜよ" "ぜよ"] ) (+v-nari ["なら" "なら"] ["なり" "なり"] ["なる" "なる"] ["なれ" "なれ"] ) (+v-tari ["たら" "たら"] ["たり" "たり"] ["たる" "たる"] ["たれ" "たれ"] ) (+v-da ["だろ" "だろ"] ;;["だっ" "だっ"] ;;["なら" "なら"] ) (+v-ya ["やろ" "やろ"] ;;["やっ" "やっ"] ;;["やら" "やら"] ) (+v-desu ["です" "です"] ;;["でし" "でし"] ) (beki ["べく" "べく"] ["べし" "べし"] ["べき" "べき"] ) (renyou ["いた" "いた"] ["った" "った"] ) ) (3 (+v-dearu ;;["であら" "であら"] ["であり" "であり"] ["である" "である"] ;;["であれ" "であれ"] ) (+v-desu ["でしょ" "でしょ"] ) ;; (beki ;; ["べから" "べから"] ;; ["べかり" "べかり"] ;; ["べかる" "べかる"] ;; ["べけれ" "べけれ"] ;; ) (renyou ["ますか" "ますか"] ) ) (4 (+v-desu ["でしょう" "でしょう"] )) (5 (n ["にかんして" "に関して"] )))) ;;; @ end ;;; (provide 'skkdic-ext) (run-hooks 'skkdic-ext-load-hook) ;;; skkdic-ext.el ends here