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

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

[elpa] externals/pyim 20d9feea63 13/58: pyim-cstring-substrings* -> pyim


From: ELPA Syncer
Subject: [elpa] externals/pyim 20d9feea63 13/58: pyim-cstring-substrings* -> pyim-cstring--substrings*
Date: Fri, 24 Jun 2022 06:57:52 -0400 (EDT)

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

    pyim-cstring-substrings* -> pyim-cstring--substrings*
---
 pyim-cstring-utils.el |  2 +-
 pyim-cstring.el       | 14 +++++++-------
 tests/pyim-tests.el   |  8 ++++----
 3 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/pyim-cstring-utils.el b/pyim-cstring-utils.el
index 7924b13101..fb759b658d 100644
--- a/pyim-cstring-utils.el
+++ b/pyim-cstring-utils.el
@@ -61,7 +61,7 @@ CHINESE-STRING 分词,得到一个词条 alist,这个 alist 的元素都是
   (pyim-dcache-init-variables)
 
   (let (result)
-    (dolist (string-list (pyim-cstring-substrings chinese-string 
max-word-length))
+    (dolist (string-list (pyim-cstring--substrings chinese-string 
max-word-length))
       (let ((pinyin-list (pyim-cstring-to-pinyin (car string-list) nil "-" t)))
         (dolist (pinyin pinyin-list)
           (let ((words (pyim-dcache-get pinyin '(code2word)))) ; 忽略个人词库可以提高速度
diff --git a/pyim-cstring.el b/pyim-cstring.el
index 9c97c81fde..e55a502090 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -55,7 +55,7 @@
           (cl-mapcar #'char-to-string string)
         (list string)))))
 
-(defun pyim-cstring-substrings (cstring &optional max-length number)
+(defun pyim-cstring--substrings (cstring &optional max-length number)
   "找出 CSTRING 中所有长度不超过 MAX-LENGTH 的子字符串,生成一个 alist。
 
 这个 alist 中的每个元素为:(子字符串 开始位置 结束位置), 参数
@@ -63,19 +63,19 @@ NUMBER 用于递归,表示子字符串在 CSTRING 中的位置。"
   (let ((number (or number 0)))
     (cond
      ((= (length cstring) 0) nil)
-     (t (append (pyim-cstring-substrings-1 cstring max-length number)
-                (pyim-cstring-substrings (substring cstring 1)
-                                         max-length (1+ number)))))))
+     (t (append (pyim-cstring--substrings-1 cstring max-length number)
+                (pyim-cstring--substrings (substring cstring 1)
+                                          max-length (1+ number)))))))
 
-(defun pyim-cstring-substrings-1 (cstring max-length number)
-  "`pyim-cstring-substrings' 的内部函数。"
+(defun pyim-cstring--substrings-1 (cstring max-length number)
+  "`pyim-cstring--substrings' 的内部函数。"
   (cond
    ((< (length cstring) 2) nil)
    (t (append
        (let ((length (length cstring)))
          (when (<= length (or max-length 6))
            (list (list cstring number (+ number length)))))
-       (pyim-cstring-substrings-1
+       (pyim-cstring--substrings-1
         (substring cstring 0 -1)
         max-length number)))))
 
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index dff65f422a..d1ceed2077 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -726,22 +726,22 @@
   (should (equal (pyim-cstring--partition "hello" t)
                  '("hello"))))
 
-(ert-deftest pyim-tests-pyim-cstring-substrings ()
-  (should (equal (pyim-cstring-substrings "我爱北京")
+(ert-deftest pyim-tests-pyim-cstring--substrings ()
+  (should (equal (pyim-cstring--substrings "我爱北京")
                  '(("我爱北京" 0 4)
                    ("我爱北" 0 3)
                    ("我爱" 0 2)
                    ("爱北京" 1 4)
                    ("爱北" 1 3)
                    ("北京" 2 4))))
-  (should (equal (pyim-cstring-substrings "我爱北京" 3)
+  (should (equal (pyim-cstring--substrings "我爱北京" 3)
                  '(("我爱北" 0 3)
                    ("我爱" 0 2)
                    ("爱北京" 1 4)
                    ("爱北" 1 3)
                    ("北京" 2 4))))
   (let* ((str "我爱北京")
-         (alist (pyim-cstring-substrings "我爱北京" 2))
+         (alist (pyim-cstring--substrings "我爱北京" 2))
          (key (car (nth 1 alist)))
          (pos (cdr (nth 1 alist))))
     (should (equal (substring str (car pos) (cadr pos)) key))))



reply via email to

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