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

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

[elpa] externals/pyim 894e4cd5e1 43/58: Remove pyim-pinyin-build-regexp


From: ELPA Syncer
Subject: [elpa] externals/pyim 894e4cd5e1 43/58: Remove pyim-pinyin-build-regexp
Date: Fri, 24 Jun 2022 06:57:55 -0400 (EDT)

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

    Remove pyim-pinyin-build-regexp
---
 pyim-pinyin.el      | 20 --------------------
 tests/pyim-tests.el | 13 +------------
 2 files changed, 1 insertion(+), 32 deletions(-)

diff --git a/pyim-pinyin.el b/pyim-pinyin.el
index 41bef56abf..c313ebd463 100644
--- a/pyim-pinyin.el
+++ b/pyim-pinyin.el
@@ -75,26 +75,6 @@
 但同时产生了无效拼音 king .  用户手动输入的无效拼音无需考虑.
 因为用户有即时界面反馈,不可能连续输入无效拼音.")
 
-(defun pyim-pinyin-build-regexp (pinyin &optional match-beginning first-equal 
all-equal)
-  "从 PINYIN 构建一个 regexp,用于搜索联想词,
-
-比如:ni-hao:
-1. ^ni-hao[a-z]* , when FIRST-EQUAL set to `t'
-2. ^ni[a-z]*-hao[a-z]* , when FIRST-EQUAL set to `nil'"
-  (when (and pinyin (stringp pinyin))
-    (let ((pinyin-list (split-string pinyin "-"))
-          (count 0))
-      (concat (if match-beginning "^" "")
-              (mapconcat
-               (lambda (x)
-                 (setq count (+ count 1))
-                 (if (or (not first-equal) (> count 1))
-                     (if all-equal
-                         x
-                       (concat x "[a-z]*"))
-                   x))
-               pinyin-list "-")))))
-
 ;; 分解拼音的相关函数
 (defun pyim-pinyin-get-shenmu (pinyin)
   "从一个拼音字符串 PINYIN 中提出第一个声母。"
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 7aac821712..d606d5b6fd 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -371,18 +371,7 @@
                    '(("h" "eng" "h" "eng")
                      ("h" "en" "h" "eng")
                      ("f" "eng" "h" "eng")
-                     ("f" "en" "h" "eng")))))
-  ;; pyim-pinyin-build-regexp
-  (should (equal (pyim-pinyin-build-regexp "ni-hao")
-                 "ni[a-z]*-hao[a-z]*"))
-  (should (equal (pyim-pinyin-build-regexp "ni-hao" t)
-                 "^ni[a-z]*-hao[a-z]*"))
-  (should (equal (pyim-pinyin-build-regexp "ni-hao" nil t)
-                 "ni-hao[a-z]*"))
-  (should (equal (pyim-pinyin-build-regexp "ni-hao" nil nil t)
-                 "ni-hao"))
-  (should (equal (pyim-pinyin-build-regexp "ni-hao" t t)
-                 "^ni-hao[a-z]*")))
+                     ("f" "en" "h" "eng"))))))
 
 ;; ** pyim-punctuation 相关单元测试
 (ert-deftest pyim-tests-pyim-punctuation ()



reply via email to

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