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

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

[elpa] externals/pyim 1d8a7a2 7/7: Add pyim-dcache-update-iword2count an


From: ELPA Syncer
Subject: [elpa] externals/pyim 1d8a7a2 7/7: Add pyim-dcache-update-iword2count and pyim-dcache-insert-icode2word
Date: Sat, 24 Apr 2021 09:57:11 -0400 (EDT)

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

    Add pyim-dcache-update-iword2count and pyim-dcache-insert-icode2word
---
 pyim-dcache.el |  8 ++++++++
 pyim.el        | 12 +++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/pyim-dcache.el b/pyim-dcache.el
index 92407e9..c90b175 100644
--- a/pyim-dcache.el
+++ b/pyim-dcache.el
@@ -200,6 +200,10 @@ VARIABLE 变量,FORCE-RESTORE 设置为 t 时,强制恢复,变量原来的
   (when pyim-dcache-auto-update
     (pyim-dcache-call-api 'update-shortcode2word force)))
 
+(defun pyim-dcache-update-iword2count (word &optional prepend 
wordcount-handler)
+  "保存词频到缓存."
+  (pyim-dcache-call-api 'update-iword2count word prepend wordcount-handler))
+
 (defun pyim-dcache-init-variables ()
   "初始化 dcache 缓存相关变量."
   (pyim-dcache-call-api 'init-variables))
@@ -295,6 +299,10 @@ MERGE-METHOD 是一个函数,这个函数需要两个数字参数,代表
   "将中文词条 WORD 从个人词库中删除"
   (pyim-dcache-call-api 'delete-word word))
 
+(defun pyim-dcache-insert-icode2word (word pinyin prepend)
+  "保存个人词到缓存."
+  (pyim-dcache-call-api 'insert-word-into-icode2word word pinyin prepend))
+
 ;; * Footer
 (provide 'pyim-dcache)
 
diff --git a/pyim.el b/pyim.el
index 6567e2e..71f5337 100644
--- a/pyim.el
+++ b/pyim.el
@@ -291,18 +291,12 @@ BUG:拼音无法有效地处理多音字。"
                         (t (pyim-cstring-to-pinyin word nil "-" t nil t)))))
       ;; 保存对应词条的词频
       (when (> (length word) 0)
-        (pyim-dcache-call-api
-         'update-iword2count
-         word
-         prepend
-         wordcount-handler))
+        (pyim-dcache-update-iword2count word prepend wordcount-handler))
       ;; 添加词条到个人缓存
       (dolist (code codes)
         (unless (pyim-string-match-p "[^ a-z-]" code)
-          (pyim-dcache-call-api 'insert-word-into-icode2word
-                                word
-                                (concat (or code-prefix "") code)
-                                prepend)))
+          (pyim-dcache-insert-icode2word
+           word (concat (or code-prefix "") code) prepend)))
       ;; TODO, 排序个人词库?
       )))
 



reply via email to

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