[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim d42cc01d44 13/35: pyim-dhashcache-calculate-priori
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim d42cc01d44 13/35: pyim-dhashcache-calculate-priority -> pyim-dhashcache--calculate-priority |
Date: |
Fri, 24 Jun 2022 08:58:06 -0400 (EDT) |
branch: externals/pyim
commit d42cc01d447e4bfa1dd6b66e9100d0103c193b60
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
pyim-dhashcache-calculate-priority -> pyim-dhashcache--calculate-priority
---
pyim-dhashcache.el | 60 ++++++++++++++++++++++++++---------------------------
tests/pyim-tests.el | 4 ++--
2 files changed, 32 insertions(+), 32 deletions(-)
diff --git a/pyim-dhashcache.el b/pyim-dhashcache.el
index 35c3317bda..2da39c0858 100644
--- a/pyim-dhashcache.el
+++ b/pyim-dhashcache.el
@@ -253,7 +253,7 @@
(maphash
(lambda (key value)
(puthash key
- (pyim-dhashcache-calculate-priority
+ (pyim-dhashcache--calculate-priority
(pyim-dhashcache--get-ishortcodes-counts-from-log
value))
pyim-dhashcache-iword2priority))
@@ -271,7 +271,7 @@
(async-inject-variables "^exec-path$")
(async-inject-variables "^pyim-.+?directory$")))
-(defun pyim-dhashcache-calculate-priority (counts-info)
+(defun pyim-dhashcache--calculate-priority (counts-info)
"根据 COUNTS-INFO 计算优先级(优先级是多个数字组成的一个列表),
用于对词条进行排序。COUNTS-INFO 是一个 alist, 其结构类似:
@@ -566,38 +566,38 @@ pyim 使用的词库文件是简单的文本文件,编码 *强制* 为 \\='utf
word 50 pyim-dhashcache-iword2count-recent-50-words))
;; 更新总 count 表
(pyim-dhashcache--put
- pyim-dhashcache-iword2count word
- (cond
- ((functionp wordcount-handler)
- (funcall wordcount-handler (or orig-value 0)))
- ((numberp wordcount-handler)
- wordcount-handler)
- (t (or orig-value 0))))
+ pyim-dhashcache-iword2count word
+ (cond
+ ((functionp wordcount-handler)
+ (funcall wordcount-handler (or orig-value 0)))
+ ((numberp wordcount-handler)
+ wordcount-handler)
+ (t (or orig-value 0))))
;; 更新 count 日志表。
(pyim-dhashcache--put
- pyim-dhashcache-iword2count-log word
- (let (out)
- (dolist (x pyim-dhashcache-count-types)
- (let* ((label (car x))
- (key (intern (format-time-string (plist-get (cdr x) :format))))
- (n (plist-get (cdr x) :max-save-length))
- (plist (cdr (assoc label orig-value)))
- (value (plist-get plist key))
- (output (if value
- (plist-put plist key (+ 1 value))
- (append (list key 1) plist)))
- (length (length output))
- (output (cl-subseq output 0 (min length (* 2 n)))))
- (push `(,label ,@output) out)))
- out))
+ pyim-dhashcache-iword2count-log word
+ (let (out)
+ (dolist (x pyim-dhashcache-count-types)
+ (let* ((label (car x))
+ (key (intern (format-time-string (plist-get (cdr x) :format))))
+ (n (plist-get (cdr x) :max-save-length))
+ (plist (cdr (assoc label orig-value)))
+ (value (plist-get plist key))
+ (output (if value
+ (plist-put plist key (+ 1 value))
+ (append (list key 1) plist)))
+ (length (length output))
+ (output (cl-subseq output 0 (min length (* 2 n)))))
+ (push `(,label ,@output) out)))
+ out))
;; 更新优先级表
(pyim-dhashcache--put
- pyim-dhashcache-iword2priority word
- ;; Fix warn
- (ignore orig-value)
- (pyim-dhashcache-calculate-priority
- (pyim-dhashcache--get-ishortcodes-counts-from-log
- (gethash word pyim-dhashcache-iword2count-log)))))
+ pyim-dhashcache-iword2priority word
+ ;; Fix warn
+ (ignore orig-value)
+ (pyim-dhashcache--calculate-priority
+ (pyim-dhashcache--get-ishortcodes-counts-from-log
+ (gethash word pyim-dhashcache-iword2count-log)))))
(defun pyim-dhashcache--update-iword2count-recent (word n hash-table)
(let (words-need-remove)
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 06f426ea64..dd16c26fdf 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -1426,8 +1426,8 @@ yin-xing 因行
'(((day 6 0 3 3 0 0 0)) ;Fixme: In github-ci will result
this value, why?
((day 10 6 0 3 3 0 0))))))
-(ert-deftest pyim-tests-pyim-dhashcache-calculate-priority ()
- (should (equal (pyim-dhashcache-calculate-priority
+(ert-deftest pyim-tests-pyim-dhashcache--calculate-priority ()
+ (should (equal (pyim-dhashcache--calculate-priority
'((day 3 7 6 4 5 9 1)))
'(69))))
- [elpa] externals/pyim e264cbe5f5 02/35: pyim-preview-delete-overlay -> pyim-preview--delete-overlay, (continued)
- [elpa] externals/pyim e264cbe5f5 02/35: pyim-preview-delete-overlay -> pyim-preview--delete-overlay, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 3454118ea9 08/35: pyim-dhashcache-init* -> pyim-dhashcache--init*, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 91ffc476b8 11/35: pyim-dhashcache-get* -> pyim-dhashcache--get*, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim e5920bae41 28/35: pyim-process-auto-select -> pyim-process--auto-select, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 93b372c8f9 01/35: pyim-preview-setup-overlay -> pyim-preview--setup-overlay, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 73ee676657 04/35: pyim-preview-delete-string -> pyim-preview--delete-string, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 9a6073f5f4 17/35: pyim-dhashcache-pinyin-string< -> pyim-dhashcache--pinyin-string<, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 46eaaa937d 10/35: pyim-dhashcache-insert* -> pyim-dhashcache--insert*, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim d8f2e8b6d6 18/35: Add comment to pyim-dhashcache.el, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 1aeddb6172 33/35: pyim-process-merge-candidates -> pyim-process--merge-candidates, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim d42cc01d44 13/35: pyim-dhashcache-calculate-priority -> pyim-dhashcache--calculate-priority,
ELPA Syncer <=
- [elpa] externals/pyim d247ac664e 03/35: pyim-preview-refresh -> pyim-preview--refresh, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim b4f252016c 16/35: pyim-dhashcache-export* -> pyim-dhashcache--export*, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 9da901bf0f 15/35: pyim-dhashcache-save* -> pyim-dhashcache--save*, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 4005949cce 21/35: pyim-process-run-delay-timer -> pyim-process--run-delay-timer, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 461b9bcc0a 22/35: pyim-process-imobjs -> pyim-process--imobjs, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 30bc394852 25/35: pyim-process-candidates -> pyim-process--candidates, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim b49d1348de 31/35: pyim-process-run-delay -> pyim-process--run-delay, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim c58b3e572b 30/35: pyim-process-autoselector-find-result -> pyim-process--autoselector-find-result, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 63f5edffb2 27/35: pyim-process-input-chinese-predicate-2 -> pyim-process--input-chinese-predicate-2, ELPA Syncer, 2022/06/24
- [elpa] externals/pyim 11c6f46974 34/35: pyim-process-handle-candidates-async -> pyim-process--handle-candidates-async, ELPA Syncer, 2022/06/24