Revision: 7277
Author:   deton.kih
Date:     Tue Aug 30 03:41:50 2011
Log:      * scm/tutcode-custom.scm
  - (tutcode-mazegaki-fixed-priority-count):
    New custom and activity hook.
* scm/tutcode.scm
  - (tutcode-prepare-commit-string):
    Change to keep candidate order for candidates
    whose index is lower than tutcode-mazegaki-fixed-priority-count.

http://code.google.com/p/uim/source/detail?r=7277

Modified:
 /trunk/scm/tutcode-custom.scm
 /trunk/scm/tutcode.scm

=======================================
--- /trunk/scm/tutcode-custom.scm       Wed Aug  3 17:40:14 2011
+++ /trunk/scm/tutcode-custom.scm       Tue Aug 30 03:41:50 2011
@@ -86,6 +86,12 @@
   (N_ "Enable learning in mazegaki conversion")
   (N_ "long description will be here."))

+(define-custom 'tutcode-mazegaki-fixed-priority-count 0
+  '(tutcode tutcode-mazegaki)
+  '(integer 0 65535)
+  (N_ "Number of candidates to be excluded from mazegaki learning")
+  (N_ "long description will be here."))
+
 (define-custom 'tutcode-use-recursive-learning? #t
   '(tutcode tutcode-mazegaki)
   '(boolean)
@@ -315,6 +321,11 @@
   (N_ "long description will be here."))

 ;; activity dependency
+(custom-add-hook 'tutcode-mazegaki-fixed-priority-count
+                 'custom-activity-hooks
+                 (lambda ()
+                   tutcode-enable-mazegaki-learning?))
+
 (custom-add-hook 'tutcode-candidate-op-count
                 'custom-activity-hooks
                 (lambda ()
=======================================
--- /trunk/scm/tutcode.scm      Thu Aug 18 04:19:07 2011
+++ /trunk/scm/tutcode.scm      Tue Aug 30 03:41:50 2011
@@ -59,6 +59,8 @@
 ;;;   libuim-skk.so¤Îµ¡Ç½¤ò»È¤Ã¤Æ¤¤¤Þ¤¹¡£
 ;;;   ¤½¤Î¤¿¤á¡¢³Ø½¬µ¡Ç½¤âSKK¤ÈƱÍÍ¤ÎÆ°ºî¤Ë¤Ê¤ê¤Þ¤¹:
 ;;;     + ³ÎÄꤷ¤¿¸õÊä¤Ï¼¡²ó¤ÎÊÑ´¹¤«¤éÀèÆ¬¤ËÍè¤Þ¤¹¡£
+;;;       tc2¤ÈƱÍͤˡ¢ÀèÆ¬¿ô¸Ä¤Î¸õÊä½ç¤òÊѤ¨¤¿¤¯¤Ê¤¤¾ì¹ç¤Ï¡¢
+;;; tutcode-mazegaki-fixed-priority-count¤Ë¤½¤Î¸Ä¿ô¤òÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
 ;;;     + ³ÎÄꤷ¤¿¸õÊä¤Ï¸Ä¿Í¼­½ñ(~/.mazegaki.dic)¤ËÊݸ¤µ¤ì¤Þ¤¹¡£
 ;;;   ¤³¤ì¤é¤Î³Ø½¬µ¡Ç½¤ò¥ª¥Õ¤Ë¤¹¤ë¤Ë¤Ï¡¢
 ;;;   tutcode-enable-mazegaki-learning?ÊÑ¿ô¤ò#f¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
@@ -1192,21 +1194,23 @@
 (define (tutcode-prepare-commit-string pc)
   (let ((res (tutcode-get-current-candidate pc))
         (suffix (tutcode-context-mazegaki-suffix pc))
-        (head (tutcode-context-head pc)))
+        (nth (tutcode-context-nth pc)))
     ;; ¤¤¤Ä¤âÆÃÄê¤Î¥é¥Ù¥ë¥­¡¼¤ÇÆÃÄê¤Î¸õÊä¤ò³ÎÄꤹ¤ë»È¤¤Êý¤¬¤Ç¤­¤ë¤è¤¦¤Ë¡¢
;; tutcode-enable-mazegaki-learning?¤¬#f¤Î¾ì¹ç¤Ï¸õÊä¤Îʤӽç¤òÊѤ¨¤Ê¤¤¡£
     ;; (Îã:¡Ö¤«¤¤¡×¤ÎÊÑ´¹¤Ë¤ª¤¤¤Æ¡¢¾ï¤Ëd¥­¡¼¤Ç¡Ö²ù¡×¡¢e¥­¡¼¤Ç¡Ö²ú¡×¤ò³ÎÄê)
-    (if tutcode-enable-mazegaki-learning?
-      (begin
+    (if (and tutcode-enable-mazegaki-learning?
+             (> nth tutcode-mazegaki-fixed-priority-count))
+      (let ((head-and-okuri-head
+              (cons (string-list-concat (tutcode-context-head pc)) "")))
         ;; skk-lib-commit-candidate¤ò¸Æ¤Ö¤È³Ø½¬¤¬¹Ô¤ï¤ì¡¢¸õÊä½ç¤¬Êѹ¹¤µ¤ì¤ë
-        (skk-lib-commit-candidate
-          tutcode-dic
-          (cons (string-list-concat head) "")
-          ""
-          (tutcode-context-nth pc)
-          #f)
-        (if (> (tutcode-context-nth pc) 0)
-          (tutcode-save-personal-dictionary #f))))
+ (skk-lib-commit-candidate tutcode-dic head-and-okuri-head "" nth #f) + ;; ÀèÆ¬¿ô¸Ä¤Î¸õÊä½ç¸ÇÄê¤Î¤¿¤á¡¢Á°¹Ô¤Î¸Æ½Ð¤ÇÀèÆ¬¤Ë¤Ê¤Ã¤¿¸õÊä¤ò²¡¤·²¼¤²¤ë
+        (do
+          ((i tutcode-mazegaki-fixed-priority-count (- i 1)))
+          ((<= i 0))
+          (skk-lib-commit-candidate tutcode-dic head-and-okuri-head ""
+            tutcode-mazegaki-fixed-priority-count #f))
+        (tutcode-save-personal-dictionary #f)))
     (tutcode-flush pc)
     (if (null? suffix)
       res

Reply via email to