cireu / jieba.el

在Emacs中使用jieba中文分词
GNU General Public License v3.0
44 stars 7 forks source link

fix jumping among punctuations #6 #7

Closed chen-chao closed 4 years ago

cireu commented 4 years ago

感谢贡献!

cireu commented 4 years ago

@chen-chao 今天又想到个更好的思路,先用这个函数跳过标点,然后再正常跳转

(defun jieba--skip-punctuations! (backward?)
  (if backward?
      (while (re-search-backward (rx punct point) nil t))
    (while (re-search-forward (rx point punct) nil t))))
chen-chao commented 4 years ago

确实比用 forward-word + backward-word 跳过标点要好.

之前还有一个改动是对中英文都返回 beg, end, 我觉得比英文返回 nil 要简单一些.