chinese-word-at-point.el icon indicating copy to clipboard operation
chinese-word-at-point.el copied to clipboard

Get (most likely) Chinese word under the cursor in Emacs

  • chinese-word-at-point.el [[http://stable.melpa.org/#/chinese-word-at-point][file:http://stable.melpa.org/packages/chinese-word-at-point-badge.svg]] [[http://melpa.org/#/chinese-word-at-point][file:http://melpa.org/packages/chinese-word-at-point-badge.svg]]

  • About =chinese-word-at-point= provides two additional =chinese-word= and =chinese-or-other-word= things for =thing-at-point= function. This library is designed to be used by other library writers, to write apps that needs to deal with Chinese, and is not useful by itself.

  • Prerequisite A Chinese word segmentation tool which has command line interface is required, you can use [[https://github.com/fxsjy/jieba][jieba (结巴中文分词)]] or [[https://github.com/hightman/scws][SCWS (简易中文分词系统)]], the former used by default, if you use the latter, you have to set ~chinese-word-split-command~.

  • Installation =chinese-word-at-point= is available on Melpa.

  • Usage Below are functions you can use:

  • Use ~(thing-at-point 'chinese-word)~ to get Chinese word at point
  • Use ~(thing-at-point 'chinese-or-other-word)~ to get any possible word (including Chinese) at point
  • use ~(chinese-word-chinese-string-p a-string)~ to test whether a string consists of pure CJK characters.

You can also use ~(chinese-word-at-point)~ and ~(chinese-or-other-word-at-point)~ if you prefer.