(concord-kanbun-word-class-canonical-p): New function.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 5 Dec 2013 15:17:18 +0000 (00:17 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 5 Dec 2013 15:17:18 +0000 (00:17 +0900)
(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

index ea26063..91e2172 100644 (file)
@@ -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))
 
                                          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)
        (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))