[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 2f2db91: pyim-imobjs-find-fuzzy:quanpin-1 -> pyim-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 2f2db91: pyim-imobjs-find-fuzzy:quanpin-1 -> pyim-pinyin-find-fuzzy |
Date: |
Tue, 25 May 2021 23:57:10 -0400 (EDT) |
branch: externals/pyim
commit 2f2db917a974460a19a10b2e056ba956aaf8b036
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
pyim-imobjs-find-fuzzy:quanpin-1 -> pyim-pinyin-find-fuzzy
* pyim-imobjs.el (pyim-imobjs-find-fuzzy:quanpin): Use Use
pyim-pinyin-find-fuzzy.
* pyim-pinyin.el (pyim-pinyin-find-fuzzy): ... to here.
(pyim-pinyin-get-charpy): Use pyim-pinyin-find-fuzzy.
(pyim-imobjs-find-fuzzy:quanpin): Use pyim-pinyin-find-fuzzy.
* pyim-imobjs.el (pyim-imobjs-find-fuzzy:quanpin-1): Move and rename
from ...
---
pyim-imobjs.el | 23 +----------------------
pyim-pinyin.el | 27 ++++++++++++++++++++++++---
2 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/pyim-imobjs.el b/pyim-imobjs.el
index 7ea4c31..b8b2c89 100644
--- a/pyim-imobjs.el
+++ b/pyim-imobjs.el
@@ -185,32 +185,11 @@ imobj 组合构成在一起,构成了 imobjs 这个概念。比如:
(dolist (imobj imobjs)
(setq fuzzy-imobjs
(pyim-permutate-list
- (mapcar #'pyim-imobjs-find-fuzzy:quanpin-1 imobj)))
+ (mapcar #'pyim-pinyin-find-fuzzy imobj)))
(push (car fuzzy-imobjs) result1)
(setq result2 (append result2 (cdr fuzzy-imobjs))))
(append result1 result2)))
-;; (\"f\" \"en\" \"f\" \"en\") -> ((\"f\" \"en\" \"f\" \"en\") (\"f\" \"eng\"
\"f\" \"en\"))
-(defun pyim-imobjs-find-fuzzy:quanpin-1 (imelem)
- "Find all fuzzy pinyins."
- (cl-labels ((find-list (str list)
- (let (result)
- (dolist (x list)
- (when (member str x)
- (setq list nil)
- (setq result
- (delete-dups
- `(,str ,@(cl-copy-list x))))))
- (or result (list str)))))
- (let* ((fuzzy-alist pyim-pinyin-fuzzy-alist)
- (sm-list (find-list (nth 0 imelem) fuzzy-alist))
- (ym-list (find-list (nth 1 imelem) fuzzy-alist))
- result)
- (dolist (a sm-list)
- (dolist (b ym-list)
- (push `(,a ,b ,@(nthcdr 2 imelem)) result)))
- (reverse result))))
-
;; * Footer
(provide 'pyim-imobjs)
diff --git a/pyim-pinyin.el b/pyim-pinyin.el
index 439619f..666ef2e 100644
--- a/pyim-pinyin.el
+++ b/pyim-pinyin.el
@@ -108,8 +108,6 @@
(cons shenmu
(substring pinyin (length shenmu)))))
-(declare-function 'pyim-imobjs-find-fuzzy:quanpin-1 "pyim-imobjs")
-
(defun pyim-pinyin-get-charpy (pinyin)
"将拼音字符串 PINYIN 分解成声母,韵母和剩余部分."
(let* ((x (pyim-pinyin-get-shenmu pinyin))
@@ -124,7 +122,7 @@
(pyim-pymap-py2cchar-get char-pinyin t))
(mapcar (lambda (x)
(concat (nth 0 x) (nth 1 x)))
- (pyim-imobjs-find-fuzzy:quanpin-1
+ (pyim-pinyin-find-fuzzy
(list shenmu yunmu shenmu yunmu))))))
(while (> i 0)
(setq yunmu (substring yunmu-and-rest 0 i))
@@ -154,6 +152,29 @@
(cons (list shenmu yunmu shenmu yunmu)
(substring yunmu-and-rest (length yunmu)))))
+;; (\"f\" \"en\" \"f\" \"en\") -> ((\"f\" \"en\" \"f\" \"en\") (\"f\" \"eng\"
\"f\" \"en\"))
+(defun pyim-pinyin-find-fuzzy (info)
+ "Find all fuzzy pinyins.
+
+INFO is a list like: (shenmu yunmu shenmu yunmu)"
+ (cl-labels ((find-list (str list)
+ (let (result)
+ (dolist (x list)
+ (when (member str x)
+ (setq list nil)
+ (setq result
+ (delete-dups
+ `(,str ,@(cl-copy-list x))))))
+ (or result (list str)))))
+ (let* ((fuzzy-alist pyim-pinyin-fuzzy-alist)
+ (sm-list (find-list (nth 0 info) fuzzy-alist))
+ (ym-list (find-list (nth 1 info) fuzzy-alist))
+ result)
+ (dolist (a sm-list)
+ (dolist (b ym-list)
+ (push `(,a ,b ,@(nthcdr 2 info)) result)))
+ (reverse result))))
+
(defun pyim-pinyin-split (pinyin)
"将一个代表拼音的字符串 PINYIN, 分解为声母韵母对组成的列表.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/pyim 2f2db91: pyim-imobjs-find-fuzzy:quanpin-1 -> pyim-pinyin-find-fuzzy,
ELPA Syncer <=