emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/pyim 17f432bddf 1/3: Add pyim-candidates--xingma-words


From: ELPA Syncer
Subject: [elpa] externals/pyim 17f432bddf 1/3: Add pyim-candidates--xingma-words
Date: Wed, 6 Jul 2022 17:57:50 -0400 (EDT)

branch: externals/pyim
commit 17f432bddff6a67b3a75497acc6158c70e391899
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>

    Add pyim-candidates--xingma-words
---
 pyim-candidates.el | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/pyim-candidates.el b/pyim-candidates.el
index feecb6f4bb..25f6f95ec9 100644
--- a/pyim-candidates.el
+++ b/pyim-candidates.el
@@ -112,23 +112,27 @@
 
         ;; 5. output => 工子又 工子叕
         (setq output
-              (let* ((personal-words (pyim-dcache-get last-code '(icode2word)))
-                     (personal-words (pyim-candidates--sort personal-words))
-                     (common-words (pyim-dcache-get last-code '(code2word)))
-                     (chief-word (pyim-candidates-get-chief scheme 
personal-words common-words))
-                     (common-words (pyim-candidates--sort common-words))
-                     (other-words (pyim-dcache-get last-code 
'(shortcode2word))))
-                (mapcar (lambda (word)
-                          (concat prefix word))
-                        `(,chief-word
-                          ,@personal-words
-                          ,@common-words
-                          ,@other-words))))
+              (mapcar (lambda (word)
+                        (concat prefix word))
+                      (pyim-candidates--xingma-words last-code scheme)))
         (setq output (remove "" (or output (list prefix))))
         (setq result (append result output))))
     (when (car result)
       (delete-dups result))))
 
+(defun pyim-candidates--xingma-words (code scheme)
+  "按照形码 scheme 的规则,搜索 CODE, 得到相应的词条列表。"
+  (let* ((personal-words (pyim-dcache-get code '(icode2word)))
+         (personal-words (pyim-candidates--sort personal-words))
+         (common-words (pyim-dcache-get code '(code2word)))
+         (chief-word (pyim-candidates-get-chief scheme personal-words 
common-words))
+         (common-words (pyim-candidates--sort common-words))
+         (other-words (pyim-dcache-get code '(shortcode2word))))
+    `(,chief-word
+      ,@personal-words
+      ,@common-words
+      ,@other-words)))
+
 (cl-defmethod pyim-candidates-create (imobjs (scheme pyim-scheme-quanpin))
   "按照 SCHEME, 从 IMOBJS 获得候选词条,用于全拼输入法。"
   ;; 这段代码主要实现以下功能:假如用户输入 nihaomazheshi, 但词库里面找不到对



reply via email to

[Prev in Thread] Current Thread [Next in Thread]