From a9ea9abcbc67621d7505b1e16787ee9b51911095 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Fri, 6 Dec 2013 00:17:18 +0900 Subject: [PATCH] (concord-kanbun-word-class-canonical-p): New function. (concord-kanbun-add-word-class): Use `<-subcategory@misc' instead of `<-subcategory' for non-canonicalized word-classes. (concord-kanbun-add-morpheme): Use function `concord-kanbun-word-class-canonical-p'; use `->entry@morpheme/misc' and `->entry@morpheme/canonical/misc' for entry-object if a morpheme does not have canonicalized word-class. --- concord-kanbun-dic.el | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/concord-kanbun-dic.el b/concord-kanbun-dic.el index ea26063..91e2172 100644 --- a/concord-kanbun-dic.el +++ b/concord-kanbun-dic.el @@ -4,6 +4,9 @@ (concord-assign-genre 'sentence@zh-classical "/usr/local/var/kanbun/db") (mount-char-attribute-table '*instance@morpheme-entry/zh-classical) +(defun concord-kanbun-word-class-canonical-p (word-class) + (memq 'mkwcs (concord-object-get word-class 'sources))) + (defun concord-kanbun-encode-name-as-id (name) (let (ucs ret) (mapconcat (lambda (c) @@ -96,7 +99,7 @@ (apply #'concord-kanbun-add-word-class (nreverse (cdr r-wcl))))) (concord-object-put - wc-cobj '<-subcategory (list parent-wc-cobj))) + wc-cobj '<-subcategory@misc (list parent-wc-cobj))) ) wc-cobj)) @@ -108,7 +111,7 @@ comment) (let* (entry-cobj canonical-entry-cobj - wc-cobj wc-name + wc-cobj wc-name wc-canonical-flag mm-name mj-name mjc-name mjc-id mjc-cobj) @@ -136,18 +139,27 @@ (setq mjc-id (intern (concord-kanbun-encode-name-as-id mjc-name))) (setq mjc-cobj (concord-make-object 'morpheme@zh-classical mjc-id)) (concord-object-put mjc-cobj '=name mjc-name) - (when (setq entry-cobj (concord-kanbun-add-morpheme-entry entry)) - (concord-object-put mjc-cobj '->entry@morpheme (list entry-cobj))) + (setq entry-cobj (concord-kanbun-add-morpheme-entry entry)) + (setq wc-cobj (concord-kanbun-add-word-class + word-superclass word-class + word-subclass1 word-subclass2 + word-subclass3)) + (concord-object-put mjc-cobj '->word-class (list wc-cobj)) + (setq wc-canonical-flag + (concord-kanbun-word-class-canonical-p wc-cobj)) + (concord-object-put mjc-cobj + (if wc-canonical-flag + '->entry@morpheme + '->entry@morpheme/misc) + (list entry-cobj)) (unless (string= entry canonical-form) (when (setq canonical-entry-cobj (concord-kanbun-add-morpheme-entry canonical-form)) - (concord-object-put mjc-cobj '->entry@morpheme/canonical + (concord-object-put mjc-cobj + (if wc-canonical-flag + '->entry@morpheme/canonical + '->entry@morpheme/canonical/misc) (list canonical-entry-cobj)))) - (when (setq wc-cobj (concord-kanbun-add-word-class - word-superclass word-class - word-subclass1 word-subclass2 - word-subclass3)) - (concord-object-put mjc-cobj '->word-class (list wc-cobj))) (concord-object-put mjc-cobj 'ja-form ja-form) (concord-object-put mjc-cobj 'ja-kana ja-kana) (concord-object-put mjc-cobj 'ja-conjugation-type ja-conj-type)) -- 1.7.10.4