[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/pyim 69f63ac 1/2: * pyim-cstring.el (pyim-cstring-to-p
From: |
ELPA Syncer |
Subject: |
[elpa] externals/pyim 69f63ac 1/2: * pyim-cstring.el (pyim-cstring-to-pinyin): 添加一个关于中英文矫正的 FIXME. |
Date: |
Wed, 8 Dec 2021 04:57:32 -0500 (EST) |
branch: externals/pyim
commit 69f63ac6c66a4b3563319c6f3b152c5083dd8552
Author: Feng Shu <tumashu@163.com>
Commit: Feng Shu <tumashu@163.com>
* pyim-cstring.el (pyim-cstring-to-pinyin): 添加一个关于中英文矫正的 FIXME.
---
pyim-cstring.el | 2 +-
tests/pyim-tests.el | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/pyim-cstring.el b/pyim-cstring.el
index 39847d1..a5a353f 100644
--- a/pyim-cstring.el
+++ b/pyim-cstring.el
@@ -232,8 +232,8 @@ BUG: 当 STRING 中包含其它标点符号,并且设置 SEPERATER 时,结
(pyim-permutate-list pinyins-list))
;; 使用 pyim 的安装的词库来校正多音字。
+ ;; FIXME:如果 string 包含非中文的字符,那么多音字矫正将不起作用。
(when adjust-duo-yin-zi
- ;; 确保 pyim 词库加载
(pyim-dcache-init-variables)
(dolist (pylist pinyins-list)
(let* ((py-str (mapconcat #'identity pylist "-"))
diff --git a/tests/pyim-tests.el b/tests/pyim-tests.el
index 766005a..57a7929 100644
--- a/tests/pyim-tests.el
+++ b/tests/pyim-tests.el
@@ -42,6 +42,7 @@
(setq default-input-method "pyim")
(setq pyim-dicts (pyim-test-get-dicts))
+(pyim-dcache-init-variables)
(ert-deftest pyim-test-pyim-permutate-list ()
(should (equal (pyim-permutate-list '((a b) (c d e) (f)))
@@ -101,7 +102,6 @@
(should (equal (substring str (car pos) (cadr pos)) key))))
(ert-deftest pyim-test-pyim-cstring-split ()
- (pyim-dcache-init-variables)
(let ((pyim-dhashcache-code2word (make-hash-table :test #'equal))
(str "我爱北京天安门"))
@@ -166,7 +166,16 @@
(should (equal (pyim-cstring-to-pinyin "银行很行" nil "-" t t)
'("yin-xing-hen-xing")))
(should (equal (pyim-cstring-to-pinyin "银行很行" nil "-" nil nil t)
- "yin-hang-hen-xing"))))
+ "yin-hang-hen-xing"))
+ (should (equal (pyim-cstring-to-pinyin "Hello 银行很行 Hi" nil "-" nil t)
+ "Hello -yin-xing-hen-xing- Hi"))
+ ;; FIXME: 这个 test 是不合理的,不过暂时找不到简单的修复方式。
+ (should (equal (pyim-cstring-to-pinyin "Hello 银行很行 Hi" nil "-" nil nil t)
+ (concat "Hello -yin-xing-hen-xing- Hi Hello
-yin-xing-hen-heng- Hi "
+ "Hello -yin-xing-hen-hang- Hi Hello
-yin-heng-hen-xing- Hi "
+ "Hello -yin-heng-hen-heng- Hi Hello
-yin-heng-hen-hang- Hi "
+ "Hello -yin-hang-hen-xing- Hi Hello
-yin-hang-hen-heng- Hi "
+ "Hello -yin-hang-hen-hang- Hi"))))
(ert-deftest pyim-test-pyim-general ()
(let ((pyim-dcache-backend 'pyim-dregcache))